asp.net - txtAddress is not declared. I cannot reference TextBox inside of AJAX .NET VB Update Panel -
trying fill few textboxes using ajax, vb .net:
<div align="left"> <asp:scriptmanager id="mainscriptmanager" runat="server" /> <asp:updatepanel id="pnladdresses" runat="server"> <contenttemplate runat="server"> <asp:dropdownlist id="ddlvenueaddresses" width="264px" height="24px" runat="server" autopostback="true" onselectedindexchanged ="ddlvenueaddresses_selectedindexchanged" cssclass="admin" backcolor="transparent" datatextfield="venuename" datavaluefield="venueaddress"></asp:dropdownlist> (optional) <br /> <input name="txtaddress" id="txtaddress" type="text" size="70" maxlength="100" value='<%= request.form.get("txtaddress")%>'/> <br /> <input name="txtgoogleaddress" type="text" size="70" maxlength="100" value='<%= request.form.get("txtgoogleaddress")%>'/> <br /> <input name="txtgooglecity" type="text" size="70" maxlength="100" value='<%= request.form.get("txtgooglecity")%>'/> <br /> <input name="txtgooglestate" type="text" size="70" maxlength="100" value='<%= request.form.get("txtgooglestate")%>'/> </contenttemplate> </asp:updatepanel> </div> </td>
dropdown list gets populated , when item picked, code stops on breakpoint should. stepping through error when trying add simple "xxxx"s textbox test:
public sub ddlvenueaddresses_selectedindexchanged(byval sender system.object, byval e system.eventargs) dim txtaddressfound textbox txtaddressfound = pnladdresses.findcontrol("txtaddress") txtaddressfound.text = "xxxxx" end sub
txtaddressfound null , when trying set "xxxxx" error:
system.nullreferenceexception unhandled user code hresult=-2147467261 message=object reference not set instance of object.
if trying set txtaddress.text = "xxxx" no findcontrol method, says doesn't exist:
? txtaddress 'txtaddress' not declared. may inaccessible due protection level.
totally lost. application has been working years, wanted use ajax populate address stuff. have ideas? have tons of textboxes on form (not using ajax on them). put @ top under inherits system.web.ui.page no luck.
protected withevents txtaddress system.web.ui.webcontrols.textbox
because trying access client side control txtaddress
server side script.
in asp.net, control should
<asp:textbox id="txtaddress" runat="server" />
this way can access server side.
Comments
Post a Comment