WebCustomControl
-
Hi, I have create a webcostom control for TextBox and add one property "Xyz".
[Bindable(true)] [Category("Appearance")] [DefaultValue("")] [Localizable(true)] public string Xyz { get { String s = (String)ViewState["Xyz"]; return ((s == null) ? String.Empty : s); } set { ViewState["Xyz"] = value; } }
and i have set the value for Xyz from client script likefunction setvalue() { form1.txt.Xyz = "Some Text"; }
on postback i want the value which is set from clientscript but the value is not set. Is there another way to set the value from clientscript and get it at serverside? -
Hi, I have create a webcostom control for TextBox and add one property "Xyz".
[Bindable(true)] [Category("Appearance")] [DefaultValue("")] [Localizable(true)] public string Xyz { get { String s = (String)ViewState["Xyz"]; return ((s == null) ? String.Empty : s); } set { ViewState["Xyz"] = value; } }
and i have set the value for Xyz from client script likefunction setvalue() { form1.txt.Xyz = "Some Text"; }
on postback i want the value which is set from clientscript but the value is not set. Is there another way to set the value from clientscript and get it at serverside?You don't have to add one more property 'Xyz' for that. You can use Text property of the textbox. Like on the client side you can set the value like this. function setvalue() { form1.TextBox1.value = "Some Text"; } and On the server side, you can get this value like this: string strGetValue = this.TextBox1.Text;
Amit Kumar HDISM, PGDCA, MCP, MCAD, MCSD
-
You don't have to add one more property 'Xyz' for that. You can use Text property of the textbox. Like on the client side you can set the value like this. function setvalue() { form1.TextBox1.value = "Some Text"; } and On the server side, you can get this value like this: string strGetValue = this.TextBox1.Text;
Amit Kumar HDISM, PGDCA, MCP, MCAD, MCSD
Hi Amit, thanx for reply. I know i can use the text property but for some reseason there is another property which i want to set from clientside and get it in serverside. its like i am adding custome attribute to a control and setting the values. its not related to the text but i am setting another value. I am doing some operation in client side after that i am setting one value for xyz and accessing that value from serverside. do you know any other way to do it? Hemant Mane.
-
Hi Amit, thanx for reply. I know i can use the text property but for some reseason there is another property which i want to set from clientside and get it in serverside. its like i am adding custome attribute to a control and setting the values. its not related to the text but i am setting another value. I am doing some operation in client side after that i am setting one value for xyz and accessing that value from serverside. do you know any other way to do it? Hemant Mane.
Hi Hemant, You can use Hidden Field also to set some value on client side and can access these values on server side easily. Since I don't know what exactly you want to do, I am unable to tell you the exact solution. The other way to proceed is you can mail me directly or can chat with me right now. my Chat IDs are : amit_chikara2002@hotmail.com and amit_chikara2002@yahoo.com
Regards, Amit Kumar HDISM, PGDCA, MCP, MCAD, MCSD amit_chikara2002@hotmail.com