vb.net - Asp.Net UpdatePanel not working -
hi having problems getting update panel function correctly in web page. have text box in user enters id hits return key populate text box address. page work's on chrome , firefox, in ie , safari each time press return key new row added volume amount. have tried overcome problem using update panel update id , address text boxes no matter new row added volume.
anyone see going wrong
<asp:content id="content2" contentplaceholderid="maincontent" runat="server"> <table border="1" width="960px"> <ajaxtoolkit:toolkitscriptmanager id="toolkitscriptmanager1" runat="server"></ajaxtoolkit:toolkitscriptmanager> <asp:updatepanel runat="server" id="updatepanel" updatemode="conditional"> <triggers> <asp:asyncpostbacktrigger controlid="button1" eventname="click" /> </triggers> <contenttemplate> <tr> <td rowspan="1">customer account code</td> <td><asp:textbox id="txtcustomercode" runat="server" placeholder="enter code press return" /></td> <asp:button id="button1" runat="server" onclick="button1_keydown" style="display: none" /> <td rowspan="1" colspan="1"><asp:dropdownlist id="dropdownlistselectaddress" class="dropdownlistselectaddress" runat="server" autopostback = "true" onselectedindexchanged = "selectedindexchanged"></asp:dropdownlist></td> </tr> <tr> <td>customer account</td> <td colspan="1" width="300px"><asp:textbox id="txtcustomer" width="300px" runat="server" ></asp:textbox></td> <td rowspan="4" colspan="1"><asp:textbox id="selectedaddresstextbox" class="selectedaddresstextboxnq" width="430px" textmode="multiline" runat="server"></asp:textbox></td> </tr> <tr> <td colspan="1">customer part number/description</td> <td colspan="2"><asp:textbox id="txtcustomerpartnumber" runat="server"></asp:textbox></td> </tr> <tr> <td colspan="1">sales person</td> <td colspan="1"><asp:textbox id="tbsalesperson" runat="server"></asp:textbox></td> </tr> <tr> <td colspan="1">end customer</td> <td colspan="1"><asp:dropdownlist id="dbendcustomer" width="100px" runat="server" onselectedindexchanged="fillselectedaddresstextbox"></asp:dropdownlist></td> </tr> </contenttemplate> </asp:updatepanel> <tr> <td colspan="1" valign="top">annual volume</td> <td colspan="2"><asp:table width="300" id="table1" runat="server" ></asp:table> <asp:button id="btnaddvolume" class="btnaddvolume" runat="server" text="add volume"/> <asp:button id="btnremovevolume" class="btnremovevolume" runat="server" text="remove volume"/></td> </tr>
sub generates volume table.
protected sub generatetable(noofrows integer) dim table table dim row tablerow dim cell tablecell dim tb textbox dim lbl label table = table1 table.id = "table1" 'page.form.controls.add(table) integer = 1 noofrows step 1 row = new tablerow() j integer = 0 1 step 1 cell = new tablecell() if j = 1 tb = new textbox() tb.id = "textboxrow_" & & "col_" & j cell.controls.add(tb) elseif j = 0 lbl = new label() lbl.id = "label" & lbl.text = "volume " & cell.controls.add(lbl) end if row.cells.add(cell) next table.rows.add(row) next 'setprevioustabledata(noofrows) viewstate("rowscount") = noofrows session("rowscount") = noofrows end sub
initialization sub
protected sub page_init(byval sender object, byval e system.eventargs) handles me.init dropdownlistselectaddress.visible = false dim menu menu = ctype(me.master.findcontrol("menu2"), webcontrols.menu) menu.items(4).text = "logout" if ispostback dim table table dim rowcount integer dim messagestring messagestring = getpostbackcontrolname() ' msgbox(messagestring) noofrows = session("rowscount") if messagestring = "btnaddvolume" noofrows = noofrows + 1 end if if messagestring = "btnremovevolume" noofrows = noofrows - 1 end if if noofrows = 0 clientscript.registerstartupscript(me.gettype(), "alert", "alert('must have @ least 1 volume');", true) noofrows = noofrows + 1 end if generatetable(noofrows) table = table1 rowcount = table.rows.count 'dim volume1 textbox 'volume1 = table.rows(0).cells(1).findcontrol("textboxrow_" & 1 & "col_" & 1) ' volume1 = page.findcontrol("textboxrow_1col_1") end if end sub
page_load sub
protected sub page_load(byval sender object, byval e system.eventargs) handles me.load if not ispostback dbcolour.autopostback = true dbcurrency.autopostback = true dbcutters.autopostback = true dbendcustomer.autopostback = true dbmanusite.autopostback = true dbmaterial.autopostback = true filldropdowns() generatetable(noofrows) selectedaddresstextbox.text = "" else ' dim table table ' table = table1 ' dim volume1 textbox ' volume1 = table.rows(0).cells(1).findcontrol("textboxrow_" & 1 & "col_" & 1) ' msgbox(volume1.text) end if dim menu menu = ctype(me.master.findcontrol("menu2"), webcontrols.menu) menu.items(4).text = "logout" if menu.items(4).selected session.clear() formsauthentication.signout() response.redirect("default.aspx") end if end sub
Comments
Post a Comment