|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
custom control client values gone with postbackHi,
I'm trying to make my own web custom control. I've made a control with 2 textboxes and 1 dropdownlist. But when I enter values in them and get a postback the values are gone. How can I hold the values typed in by the client?? (for processing on the server but also to display them back) tia could this be an enableviewstate=false issue?
Show quoteHide quote "Pipo" <P***@home.com> schreef in bericht news:Oee8red8FHA.2176@TK2MSFTNGP14.phx.gbl... > Hi, > > I'm trying to make my own web custom control. > I've made a control with 2 textboxes and 1 dropdownlist. > But when I enter values in them and get a postback the values are gone. > How can I hold the values typed in by the client?? > (for processing on the server but also to display them back) > > tia > Nope...all the controls have viewstate enabled!!!
Show quoteHide quote "Edwin Knoppert" <n***@hellobasic.com> schreef in bericht news:438734a9$0$2339$ba620dc5@text.nova.planet.nl... > could this be an enableviewstate=false issue? > > > "Pipo" <P***@home.com> schreef in bericht > news:Oee8red8FHA.2176@TK2MSFTNGP14.phx.gbl... >> Hi, >> >> I'm trying to make my own web custom control. >> I've made a control with 2 textboxes and 1 dropdownlist. >> But when I enter values in them and get a postback the values are gone. >> How can I hold the values typed in by the client?? >> (for processing on the server but also to display them back) >> >> tia >> > > I have a similar problem with a dropdownlist.
it is populated in the page_load, the selected item get's lost. So i obtain the value from the request.form stuff. (I want it this way) Show quoteHide quote "Pipo" <P***@home.com> schreef in bericht news:ODgDbQe8FHA.3660@TK2MSFTNGP09.phx.gbl... > Nope...all the controls have viewstate enabled!!! > > "Edwin Knoppert" <n***@hellobasic.com> schreef in bericht > news:438734a9$0$2339$ba620dc5@text.nova.planet.nl... >> could this be an enableviewstate=false issue? >> >> >> "Pipo" <P***@home.com> schreef in bericht >> news:Oee8red8FHA.2176@TK2MSFTNGP14.phx.gbl... >>> Hi, >>> >>> I'm trying to make my own web custom control. >>> I've made a control with 2 textboxes and 1 dropdownlist. >>> But when I enter values in them and get a postback the values are gone. >>> How can I hold the values typed in by the client?? >>> (for processing on the server but also to display them back) >>> >>> tia >>> >> >> > > I think I have the same problem. Look here:
http://www.dotnetnewsgroups.com/newsgroupthread.asp?ID=205651&NewsgroupI D=9 Isn't there a solution? Thanks, Gellert Problem Solved:
Hello all, I could solved the Problem with an article "Extending a TextBox Control in ASP.NET" by Anthony Hart. Here is the important part is to use the ViewState: get { this.EnsureChildControls(); //This was the old code: return selectedvalue; return ((string)ViewState["something"]); } set { this.EnsureChildControls(); //This was the old code: selectedvalue = value.ToString(); This was the old code ViewState["something"] = value; Now it is working. here is the Link to the article: http://www.eggheadcafe.com/articles/pfc/extendservercontrol.asp Look at the "ViewState" section ! Gellert No...no...no this does not solve my problem!!!
I have 3 controls (2 textboxes and 1 dropdownlist) The values entered by the client are lost by a postback!! In the get I dont have any references to the controls anymore (this.Controls.Count = 0) I can not get the values of the controls... string EnteredData { get { //This will NOT work cos all the properties are empty after a postback!: return TextBox1.text + TextBox2.text + dropdownlist1.selectedindex.tostring(); //This doesnt work either because the controls.Count =0!!!: return ((TextBox)Controls[0]).text + ((TextBox)Controls[1]).text; } } I am not setting the values (the client is) so I dont have a set..... Any ideas? tia Show quoteHide quote "Gellert" <radi***@gmx.at> schreef in bericht news:%23Yzyhim8FHA.2364@TK2MSFTNGP12.phx.gbl... > Problem Solved: > > > Hello all, > > I could solved the Problem with an article "Extending a TextBox Control > in ASP.NET" by Anthony Hart. > > Here is the important part is to use the ViewState: > get > { > this.EnsureChildControls(); > //This was the old code: return selectedvalue; return > ((string)ViewState["something"]); > > } > set > { > this.EnsureChildControls(); > //This was the old code: selectedvalue = value.ToString(); This was the > old code > ViewState["something"] = value; > > Now it is working. > > here is the Link to the article: > http://www.eggheadcafe.com/articles/pfc/extendservercontrol.asp > Look at the "ViewState" section ! > > Gellert > > -- > Sent via .NET Newsgroups > http://www.dotnetnewsgroups.com I already have written a usercontrol with two textboxes.
And they do work. i obtain the text entered during a button_click event. As mentioned, i'm obtaining it using request, because the controls where empty, as you mentioned. Dim s As String = Request.Form(Me.uc1.Text1_GetUniqueID).ToUpper.Trim Note that Text1_GetUniqueID is only a property obtaining the unique ID from the textbox. Nothing serious. Show quoteHide quote "Pipo" <P***@home.com> schreef in bericht news:uwV1E6s8FHA.3224@TK2MSFTNGP09.phx.gbl... > No...no...no this does not solve my problem!!! > I have 3 controls (2 textboxes and 1 dropdownlist) > The values entered by the client are lost by a postback!! > > In the get I dont have any references to the controls anymore > (this.Controls.Count = 0) > I can not get the values of the controls... > > string EnteredData > { > get > { > //This will NOT work cos all the properties are empty after a postback!: > return TextBox1.text + TextBox2.text + > dropdownlist1.selectedindex.tostring(); > > //This doesnt work either because the controls.Count =0!!!: > return ((TextBox)Controls[0]).text + ((TextBox)Controls[1]).text; > } > } > > I am not setting the values (the client is) so I dont have a set..... > Any ideas? > > tia > > > > "Gellert" <radi***@gmx.at> schreef in bericht > news:%23Yzyhim8FHA.2364@TK2MSFTNGP12.phx.gbl... >> Problem Solved: >> >> >> Hello all, >> >> I could solved the Problem with an article "Extending a TextBox Control >> in ASP.NET" by Anthony Hart. >> >> Here is the important part is to use the ViewState: >> get >> { >> this.EnsureChildControls(); >> //This was the old code: return selectedvalue; return >> ((string)ViewState["something"]); >> >> } >> set >> { >> this.EnsureChildControls(); >> //This was the old code: selectedvalue = value.ToString(); This was the >> old code >> ViewState["something"] = value; >> >> Now it is working. >> >> here is the Link to the article: >> http://www.eggheadcafe.com/articles/pfc/extendservercontrol.asp >> Look at the "ViewState" section ! >> >> Gellert >> >> -- >> Sent via .NET Newsgroups >> http://www.dotnetnewsgroups.com > > No...no...no this does not solve my problem!!!
I have 3 controls (2 textboxes and 1 dropdownlist) The values entered by the client are lost by a postback!! In the get I dont have any references to the controls anymore (this.Controls.Count = 0) I can not get the values of the controls... string EnteredData { get { //This will NOT work cos all the properties are empty after a postback!: return TextBox1.text + TextBox2.text + dropdownlist1.selectedindex.tostring(); //This doesnt work either because the controls.Count =0!!!: return ((TextBox)Controls[0]).text + ((TextBox)Controls[1]).text; } } I am not setting the values (the client is) so I dont have a set..... Any ideas? tia Show quoteHide quote "Gellert" <radi***@gmx.at> schreef in bericht news:%23Yzyhim8FHA.2364@TK2MSFTNGP12.phx.gbl... > Problem Solved: > > > Hello all, > > I could solved the Problem with an article "Extending a TextBox Control > in ASP.NET" by Anthony Hart. > > Here is the important part is to use the ViewState: > get > { > this.EnsureChildControls(); > //This was the old code: return selectedvalue; return > ((string)ViewState["something"]); > > } > set > { > this.EnsureChildControls(); > //This was the old code: selectedvalue = value.ToString(); This was the > old code > ViewState["something"] = value; > > Now it is working. > > here is the Link to the article: > http://www.eggheadcafe.com/articles/pfc/extendservercontrol.asp > Look at the "ViewState" section ! > > Gellert > > -- > Sent via .NET Newsgroups > http://www.dotnetnewsgroups.com I already have written a usercontrol with two textboxes.
And they do work. i obtain the text entered during a button_click event. As mentioned, i'm obtaining it using request, because the controls where empty, as you mentioned. Dim s As String = Request.Form(Me.uc1.Text1_GetUniqueID).ToUpper.Trim Note that Text1_GetUniqueID is only a property obtaining the unique ID from the textbox. Nothing serious. Show quoteHide quote "Pipo" <P***@home.com> schreef in bericht news:uwV1E6s8FHA.3224@TK2MSFTNGP09.phx.gbl... > No...no...no this does not solve my problem!!! > I have 3 controls (2 textboxes and 1 dropdownlist) > The values entered by the client are lost by a postback!! > > In the get I dont have any references to the controls anymore > (this.Controls.Count = 0) > I can not get the values of the controls... > > string EnteredData > { > get > { > //This will NOT work cos all the properties are empty after a postback!: > return TextBox1.text + TextBox2.text + > dropdownlist1.selectedindex.tostring(); > > //This doesnt work either because the controls.Count =0!!!: > return ((TextBox)Controls[0]).text + ((TextBox)Controls[1]).text; > } > } > > I am not setting the values (the client is) so I dont have a set..... > Any ideas? > > tia > > > > "Gellert" <radi***@gmx.at> schreef in bericht > news:%23Yzyhim8FHA.2364@TK2MSFTNGP12.phx.gbl... >> Problem Solved: >> >> >> Hello all, >> >> I could solved the Problem with an article "Extending a TextBox Control >> in ASP.NET" by Anthony Hart. >> >> Here is the important part is to use the ViewState: >> get >> { >> this.EnsureChildControls(); >> //This was the old code: return selectedvalue; return >> ((string)ViewState["something"]); >> >> } >> set >> { >> this.EnsureChildControls(); >> //This was the old code: selectedvalue = value.ToString(); This was the >> old code >> ViewState["something"] = value; >> >> Now it is working. >> >> here is the Link to the article: >> http://www.eggheadcafe.com/articles/pfc/extendservercontrol.asp >> Look at the "ViewState" section ! >> >> Gellert >> >> -- >> Sent via .NET Newsgroups >> http://www.dotnetnewsgroups.com > > ...
Autopostback is enabled for each control? Can you post your whole code, or send it to me: radi***@gmx.at I will have a look. Gellert Hi Gellert,
Thanks for your time. I've mailed you the code. Show quoteHide quote "Gellert" <radi***@gmx.at> schreef in bericht news:epVZMBt8FHA.808@TK2MSFTNGP09.phx.gbl... > .. > > Autopostback is enabled for each control? > > Can you post your whole code, or send it to me: radi***@gmx.at > > I will have a look. > > Gellert > > -- > Sent via .NET Newsgroups > http://www.dotnetnewsgroups.com
Cool Web Parts?
Newbie - question concerning page behaviour One comment about the implementation of Session FormView DateTime bug?? Problems with Custom Web Controls in VS 2005 Mouseover, mouseout, click etc on datagrid. DataList Issue Time textbox control TableAdapter Scalar or "Single Value" Queries regular expression |
|||||||||||||||||||||||