Reference specific asp.net control using vb.net code bhind variable -
i have read through many different solutions both here on , other sites keeps eluding me.
i trying reference asp.net textbox , image button code behind vb.net.
i have tried code variable tbox says equal nothing.
dim callbtn imagebutton = ctype(sender, imagebutton) dim tbox textbox dim ibutton imagebutton dim cnumber integer = convert.toint32(callbtn.id.substring(11)) tbox = ctype(page.findcontrol("textbox" & cnumber), textbox) 'the line below commented out because did not work either first 1 tried 'tbox = directcast(page.findcontrol("textbox" & cnumber), textbox) tbox.text = "" <--- on line tbox nothing tbox.visible = false i have placed break point on tbox.text line , tbox equals nothing.
how can reference text box variable? need reference , image button need 1 work first.
if there question on here answers please point me not find one.
edit: update here code creates textbox , image button.
<asp:imagebutton id="imagebutton1" runat="server" visible="false" onclick="removefile" imageurl="~/images/red-x-md20x20.png" imagealign="top" tooltip="click remove file" />  <asp:textbox id="textbox1" runat="server" visible="false" width="300px" />
it turns out not looking right name. being on content page had reference master page first.
i used following:
dim ctrlnamet string = "ctl00$contentplaceholderright$textbox" & cnumber this did trick!
Comments
Post a Comment