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

How to get text of a label on server side that is filled by javascript Client side event ?..

2 Answers 528 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Amit
Top achievements
Rank 1
Amit asked on 21 Oct 2010, 06:09 AM
Hey everyone,

I have used a textbox on blur client side event to get text on to the label like this...
function show(txtQuantityE, lblRate, lblAmount)
            {
               var txtQuantityE = $find(txtQuantityE);
               var lblRate = document.getElementById(lblRate);
               var lblAmount = document.getElementById(lblAmount);
               lblAmount.innerHTML = parseInt(txtQuantityE.get_value()) * parseInt(lblRate.innerHTML);
            }
now i am trying to get this value of label filed by OnBlur event on server side to save it in a data Table.But its coming null.My CS is--
DataRow drValues = dtValues.NewRow();
                drValues["Items"] = combo.SelectedItem.Text;
                drValues["Rate"] = lblRate.Text;
                drValues["Quantity"] = txtQauntityE.Text;
                drValues["Amount"] = lblAmount.Text;
                dtValues.Rows.Add(drValues);
                dtValues.AcceptChanges();
drValues["Amount"] = lblAmount.Text;
This row is null when i debug using breakpoints.Hence,can't get this value inside my data Table.How should i do this?... 

Thanks
Amit

2 Answers, 1 is accepted

Sort by
0
Accepted
Iana Tsolova
Telerik team
answered on 26 Oct 2010, 10:14 AM
Hello Amit,

Values set with client-side code for controls that have no client-state, like the Label control are lost after postback. You can use hidden fields instead, set their value client value client-side and then you should be able to get on the server.

Regards,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Amit
Top achievements
Rank 1
answered on 26 Oct 2010, 10:33 AM
Thanks lana,that worked..
Tags
Grid
Asked by
Amit
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Amit
Top achievements
Rank 1
Share this question
or