This is a migrated thread and some comments may be shown as answers.

Extracting set_value Server Side

5 Answers 137 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
rdochert
Top achievements
Rank 1
rdochert asked on 13 Jan 2008, 09:55 PM
i'm using radcombo with a radgrid for item selection. i use the telerik suggested javascript to set_text of the combo which is then available server side.

all good.

but, i have a PK which i also need to extract from the combo and i dont want this to appear in the combo text. so, i used the client side set_value function to store but when i get client side there is no sign of this. i'm not even sure where i'm supposed to collect it from since there is no "value" for the combo, only selectedvalue.

i suppose i could store the information in a hidden field but i would prefer the more elegant solution of extracting it from the combo.

can you help with that.
thanks,
rob

5 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 14 Jan 2008, 09:02 AM
Hello rdochert,

Would you please go into some more details on what exactly you are up to? Is it that you need to set the value at the client-side, fire a postback and then obtain the selected value at the client?

Regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
rdochert
Top achievements
Rank 1
answered on 14 Jan 2008, 09:16 AM

hi nick,
here is the client side code i am using:

$find("<%= RadComboBox1.ClientID %>").set_text(valueStringBuilder.join(""));
$find("<%= RadComboBox1.ClientID %>").set_value(args.getDataKeyValue("eListRef"));
document.getElementById("<%= emailFrom.ClientID %>").value = args.getDataKeyValue("eFromName") + " <" + args.getDataKeyValue("eFromEmail") + ">";
document.getElementById("<%= listRef.ClientID %>").value = args.getDataKeyValue("eListRef");

the last line is storing the selected "eListRef" into a textbox because the second line, which does a "set_value" does not appear to persist to the server side. when i process the form after postback, i can only find the Text of the RadComboBox1, i can't find the "value" as set by the "set_value" statement above.

thanks,
rob

0
Nikolay
Telerik team
answered on 15 Jan 2008, 11:18 AM
Hi rdochert,

You should call the trackChanges() and commitChanges() methods of the combobox object to persist the changes at the server-side. Attached, please find a small and running project on the matter. Download the files and give them a go.

I hope this will get you started.

Regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
rdochert
Top achievements
Rank 1
answered on 16 Jan 2008, 07:11 PM
unfortunately that did not help. i asjusted the client side as below but still no value in the selected value property server side. probably something to do with using a grid i suspect.

function onRowSelected(sender, args)

{

var valueStringBuilder = [

args.getDataKeyValue(

"eType"),

": ", args.getDataKeyValue("eName"),

" (", args.getDataKeyValue("eCount"), " recipients)"

];

var combo = $find("<%= RadComboBox1.ClientID %>")

combo.trackChanges();

combo.set_text(valueStringBuilder.join(

""));

combo.set_value(args.getDataKeyValue(

"eListRef"));

combo.commitChanges();

document.getElementById(

"<%= emailFrom.ClientID %>").value = args.getDataKeyValue("eFromName") + " <" + args.getDataKeyValue("eFromEmail") + ">";

document.getElementById(

"<%= listRef.ClientID %>").value = args.getDataKeyValue("eListRef");

}



0
Jeff
Top achievements
Rank 1
answered on 17 Jan 2008, 01:10 AM
Hi Rob,

    Check which version of the dll you are using. I had a number of issues with the combobox value with 12/18/07 (and earlier) version. One of the issues I had, which sounds similar to yours, was I was setting the value, but was not able to retrieve it on the server side code, or the client side code for that matter. I could only retrieve the text of the combobox. I got a hot fix for this in January, which later was part of the 1/15/08 release. This fixed my issue.
    I noticed that your post was originally from 1/13/08, which is before the latest release that had the fix for the combobox value issues.

    Just my 2 cents worth.

Jeff
Tags
ComboBox
Asked by
rdochert
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
rdochert
Top achievements
Rank 1
Jeff
Top achievements
Rank 1
Share this question
or