Argh...I apologize for bugging everyone at this time of the year, but I am having issues trying to retrieve the selected values from a combo box inside client javascript and am working on a demanding schedule.
I have a combo box (for example) populated as:
Item 1: Text=Sell; Value=1.
Item 2: Text=Rent; Value=2.
Item 3: Text=Trade; Value=3.
When the user selects an item from the combo (and enters text in a couple of textboxes) then clicks on an item on the screen, I need to open a new window and pass the value selected in the combo box. I can't do this inside the server code, because a postback would end up basically performing a redirect and I need to keep the original window on the screen.
I cannot capture the combo box selected value when the user selects it, because they may just use the default value thus not triggering any events on the combo box before clicking on the screen item to continue.
I should add that I am using the combo box on a page that utilizes a master page, and that the combo box is defined inside a RadDock.
In my client javascript, I have tried several methods of doing this, but all I can seem to retrieve is the text value displayed in the combo box. For examples:
The combo box is defined as shown below.
SUMMARY QUESTION: What I need to retrieve from the combo box is the data loaded as the "value". In the examples above, this would be either the 1, 2, or 3 -- not sell, rent, or trade. How do I get the true selected value from the combo?
Thanks very much in advance!
Lynn
I have a combo box (for example) populated as:
Item 1: Text=Sell; Value=1.
Item 2: Text=Rent; Value=2.
Item 3: Text=Trade; Value=3.
When the user selects an item from the combo (and enters text in a couple of textboxes) then clicks on an item on the screen, I need to open a new window and pass the value selected in the combo box. I can't do this inside the server code, because a postback would end up basically performing a redirect and I need to keep the original window on the screen.
I cannot capture the combo box selected value when the user selects it, because they may just use the default value thus not triggering any events on the combo box before clicking on the screen item to continue.
I should add that I am using the combo box on a page that utilizes a master page, and that the combo box is defined inside a RadDock.
In my client javascript, I have tried several methods of doing this, but all I can seem to retrieve is the text value displayed in the combo box. For examples:
Example 1. The following code retrieves the actual visible text value from the combo (i.e. - trade, sell, rent)
a1 = document.getElementById("<%= ListTranType.ClientID %>").value;
alert(a1);
var b1 = $find("<%= ListTranType.ClientID %>");
alert(b1);
var b2 = b1.value;
alert(b2);
var b1 = $find("<%= ListTranType.ClientID %>").value;
alert(b1);
The combo box is defined as shown below.
<
telerik:RadComboBox ID="ListTranType" OnClientSelectedIndexChanged="gettrantype" EnableEmbeddedSkins="true" Skin="Black" runat="server" Width="200px" ></telerik:RadComboBox>
I do have a script for capturing the value when the user selects one and it works fine as it is, but as said earlier sometimes the user will use the default value or not select one from the combo before clicking to proceed. Both of these actions are valid within the application. The code used to capture the value during the event is:
<script type="text/javascript">
var trantype;
function gettrantype(combo, eventArqs) {
var item = eventArqs.get_item();
trantypeval = item.get_value();
}
SUMMARY QUESTION: What I need to retrieve from the combo box is the data loaded as the "value". In the examples above, this would be either the 1, 2, or 3 -- not sell, rent, or trade. How do I get the true selected value from the combo?
Thanks very much in advance!
Lynn