On selecting value in second listbox. selected value in first textbox is lost

 

 

 Hello all,

 In a webapplication , I have to store the selected values in hidden fields with following code  <INPUT type="hidden" name="hidPatient" value="">

<INPUT type="hidden" name="hidPatientStatus" value="">

 when i select the value in any list box following javascript function is called with this code

 

Response.Write "<SELECT id=" & strSelName & " name=" & strSelName & " validation=" & strValidation & " displaytype=select fetchfieldid='" & strFieldNameID & "' fetchfieldname='" & strFieldName & "' TableName='" & strDisplayTableName & "' fieldname='" & strDisplayFieldName & "' multiple style='height:100px' ; onChange='javascript:getMyfunc();' "+">"

function getMyfunc()---->Javascript function

{

getReportName();

var strSelValueP = document.frmReports.selPatientAndDoctorLastName.value//options[intSelIndexP].value

document.frmReports.hidPatient.value = strSelValueP

var strSelValueS = document.frmReports.selStatusStatus.value

document.frmReports.hidPatientStatus.value = strSelValueS

}

 

and values are stored with the following code

strPatient = Request.Form("hidPatient")

strPatientStatus = Request.Form("hidPatientStatus")

 

With above situation I want both values selected from both listbox at once. but when i select Patient(First) listbox I lost the selected value in Stautus listbox(second) and  vise versa.

Please suggest  to get both the values from both listbox without loosing after selection.

Actualy  item in listboxes does not remain selected after postback 

I have enabled runat="server" and enableviewstate="true "

 still problem not resolved 

 

0
Swati
12/11/2007 7:29:46 AM
asp.net.client-side 24353 articles. 1 followers. Follow

1 Replies
848 Views

Similar Articles

[PageSpeed] 28

Response.write wrotes the text out of Hirerchy of HTML

Instead try using literalcontrol set its text or inner html property to the text your trying render

satalaj 


Watch The true story of internet ||Yet another forum |||
I'm big fan of Open source flash chart for .net very very simple
I n t e r v i e w T i p s
0
satalaj
12/11/2007 10:32:40 AM
Reply:

Similar Artilces:

Dropdownlist selected value passes first value in list no matter what value is selected. why ?
 HI . I have a dropdownlist. Databinds ok but when I must pass a value as a Selected value it always passes the first value in the list even if I select another value. I tried to set the ddl to enableviewstate false but it doesn't change anything. Any ideas ? Code below, thanksLoading the ddl:       productCategories = CatalogAdmin.Admin_Product_Categories_NotIn(productId);        for (int i = 0; i < productCategories.Rows.Count; i++)        {       &...

to change value of Client Side Select html control from database value....
hello forum,  I have a select .. Demo.aspx <select id="DropAccType" name="DropAccType"> <option>Select</option> <option>Saving</option> <option >Current</option> <option>Regular</option> <option>Demat</option> </select> I want to set the value of select by fetching the data from daabase i.e. In my table if I have Value current then when i request the demo.aspx then in select Control the value Current should get selected..... Please help me to sort this out...   Thnx in advance.. Hi-I could be...

Multiple-Select Listbox only returns first selected value (and I'm not using SelectedItem...)
I'm looping through the items of a listbox, as you can see I'm raising a custom event, passing the selected values with custom event args up...  What happens however, is that only the first item will be tagged as being selected, no matter how many listbox items I select with control. Ie If I select "Transducer, Pressure Transmitter, Pressure & Temperature" the following is returned: Transducer is selected;Pressure transmitter is not selected;Pressure & Temperature is not selected; I encoded the ampersand & so do not worry about string concat. This is t...

Second SELECT-box doesn't show the selected value as SELECTED
Hi! I usually find what I look for in the other threads, but now I've spent two weeks searching and I still can't work this out, even though I'm sure the solution is easy:( Why doesn't my second dropdown-list show the selected value Arb (which shows in the url-window as for example myPage.asp?Ar=1976&Arb=1987) as selected? It manages to use the Ar-variable for the first SELECT-box, but the second box always has the first querystring-value selected, as if Arb="". I've also tried using a second sql-query, doing exactly as with the first SELECT-box, without success. Is ...

Cascading Dropdown - Initially selected value
Hi there, I am having an issue with a pretty basic problem. I have managed to get the cascading drop down lists working ok with information coming from a database. On the initial page, I need to have a value in the drop down list already selected, i.e. the current year in one drop down and current month in the next. The information from both of these is sent to a query to output a datatable. Can anyone help with this? I'm not sure I understand the scenario, but I think the new CascadingDropDownNameValue(..., defaultValue) constructor may be just what you're looking for. (First available ...

Selected value in select list with javascript based off value in database
 I've got a classic asp page with a select list. I need the select list's selected value to be whatever the user selected when they created their account. I've been trying to use <body onLoad="onLoad();"> to call my function, and then I'm trying to specify which value should be selected in the function. Also, when the select list selected values change, there is a javascript function I call to disable text boxes. I think there is an issue with my javascript function, and I can't find any examples of this from good ole' google.  My j...

Option Selection is lost in Grid when I postback , but I can get the option value (just selection point only lost)
hi All,I'm using option buttone (html control) in a Grid Which is working properly...If I postback the form by any other control my previous Selection is lost...I need to apper the selection after the form postback.PRabakar I guess you are using plain html controls, right?. Consider converting those to server side html controls by adding runat="server" to the declaration of the radio buttons. You will have to make sure viewstate of the grid is enabled CheersBug [MCSD]...

dropdownlist's selected index value is not printing the selected value
Here iS my code .Aspx Page <asp:DropDownList ID="ddlkeyword" runat="server" Width="204px" DataTextField="Form" DataValueField="Form" OnSelectedIndexChanged="ddlkeyword_SelectedIndexChanged" >   </asp:DropDownList> <asp:Button ID="Button1" runat="server" Text="Submit" Width="110px" OnClick="Button1_Click" /> my aspx.cs protected void Page_Load(object sender, EventArgs e) { fillddlkeyword(); }protected void Page_Init(object sender, EventArgs e) { ...

Selecting value in one field then causes value in another field to be selected.
I have a web form which contains a date field, the date is populated using a DatePicker which is Javascript based. The form also has a drop down box containing 3 values. What I want to do is when a date has been selected that this will cause the dropdown list value to change to dated which is one of its 3 values. i.e. when the date field is not blank then the value will be selected in the dropdown. What I also want to happen is when the date has been selected and the dropdown value is dated then the date field and the dropdown field will be set to read only.Anyone any ideas how to this usin...

Selecting a Value in a Drop Down List Based on the Value of a Textbox
I have a formview control (.NET 2.0/VS2005) in which users enter company contact information.  When a user enters a postal code in the appropriate text box, the territory for that company needs to be calculated and displayed in a territory drop down list. I know how to calculate and retrieve the territory from my SQL Server database, but I can't seem to nail down how to trigger the code and don't want the user to have to click a button. I tried using the OnTextChanged event, but that doesn't seem to be what I want because I need this calculation to be performed pri...

DropDown list submits first value not the selected value
I am relatively new to programming and am having a problem with a small project that I am working on.  I have a names drop down list that is created from a database.  When the user selects a name and completes the rest of the form and clicks submit.  All of the data they entered is submitted to a different table in that database.  This is workign correctly for all of the data except the drop down.  For some reason the first value in the drop down is being submitted each time.  Here is the code and any help you can give will be appreciated. Public Class final1 ...

DropDownList selected value determines value of second DropDownList
I have a quick question that I'm sure has been addressed before, but I can't seem to find a solution. I have two drop down list fields: startTime and endTime coded as such: <asp:DropDownList id="startTime" runat="server"> <asp:ListItem Value="00:00">12:00 A.M.</asp:ListItem> <asp:ListItem Value="00:30">12:30 A.M.</asp:ListItem> <asp:ListItem Value="01:00">1:00 A.M.</asp:ListItem> <asp:ListItem Value="...

How to show value in textbox from selected value in Dropdown list
I have two text box, txtbox1 should be from two field for example i have one dropdownlist where i select item and another txtbox2 i want to put value, when i first time to write manually value in txtbox2 in and selected item from ddl i want to result in concatenate from in txtbox1. for example  I haveif not me.ispostback thenDim cm as new sqlcommand("Select AccMjrid, Names from Accgrp", me.sqlconnection1.open())me.sqldataAdapter1.fill(Dataset1, "Accgrp") Me.cmbAccMajID.DataSource = Me.DataSet11.Tables("AccMajor") Me.cmbAccMajID.DataTextField = "AccName" Me.cmbAccMajID.DataValueField ...

ListBox selected index change problem with selected value
I have a problem with my list box selected index changed. There are two items in the list box one is a Group Name and then below each group are email addresses that go with those groups. When I select the group name it puts the selected value where it is equal to group_id  the select statement looks like this and works correctly: SELECT d.group_descr, a.first_name, a.last_name, a.user_id, b.email, d.group_id, d.parent_group_id FROM icc_user_data AS a LEFT OUTER JOIN icc_users AS b ON a.user_id = b.user_id LEFT OUTER JOIN icc_users_groups AS c ON a.user_id = c.user_id LEFT OUTER JOIN ...

Web resources about - On selecting value in second listbox. selected value in first textbox is lost - asp.net.client-side

Consultation Document on the Methods for Selecting the Chief Executive and for Forming the LegCo in 2012 ...
The " Consultation Document on the Methods for Selecting the Chief Executive and for Forming the LegCo in 2012 " was a document published on ...

Voting Machine Caught on Camera Casting Ballot for Democrat when Selecting Republican - YouTube
**UPDATE.... I've heard many reports that this is "just a calibration issue." I will say this... when I went to page 2 and began voting for city ...

Selecting The Right Jeans
Fit, style, cut, colour and wash all factor into the pursuit for great denim.

Clock ticking on selecting successor to Leigh Clifford at Qantas
With Qantas on course to chalk up its largest annual profit since 2008, the question now is whether chairman Leigh Clifford is looking to hang ...

Why are the reserves selecting the team?
Backbenchers are the reserves of the parliamentary system. They are newcomers.

Jackie French: Why selecting the right place for your plants is important
The secret of growing anything easily is to choose the best spot for what you want to grow.

Netflix turns to pirates when selecting new shows
Imagine the surprise, then, when the popular video streaming site admitted that it actually turns to torrenters for inspiration. "With the purchase ...

Boston Marathon bombing trial: Judge, lawyers face challenges in selecting jurors - CTV News
As the second phase of jury selection began in the federal death penalty trial of Boston Marathon bombing suspect Dzhokhar Tsarnaev, it immediately ...

Selecting cabinet one of first orders of business for Trudeau
One of the first orders of business for any new prime minister is picking a cabinet. Who is likely to make the cut?

Agile Analysis, Self-Selecting Teams, TDD & BDD in Methods & Tools Winter 2014 issue
... for software developers, testers and project managers – has just published its Winter 2014 issue that discusses Agile Analysis, Self-Selecting ...

Resources last updated: 1/5/2016 4:00:31 AM