ASP.NET/SQL find the element ID and update database -
basically i've got update query runs when click submit button.
i have asp:repeater
in page layer inside this
<asp:repeater id="dgbookings" runat="server" onitemdatabound="itemdb"> <itemtemplate> <div class="bookingscontent"> <div class="bookingdetails" id="<%# databinder.eval(container.dataitem, "booking_ref") %>"> <p class="infotext"><%# databinder.eval(container.dataitem, "adults") %> <asp:linkbutton onclick="editdetails" text="edit..." runat="server"></asp:linkbutton></p> <p class="infotext"><asp:linkbutton onclick="submitdetails" text="submit..." runat="server"></asp:linkbutton></p> </div> </div> </itemtemplate> <asp:repeater>
and outputs html this
<div class="bookingscontent"> <div class="bookingdetails" id="al05720"> <p class="infotext">2</p> <p class="infotext"> <a href="javascript:__dopostback('dgbookings$ctl00$ctl08','')">submit...</a></span> <a class="editadults" href="#" onclick="return false">edit...</a></p> </div> </div> <div class="bookingscontent"> <div class="bookingdetails" id="bd45670"> <p class="infotext">4</p> <p class="infotext"> <a href="javascript:__dopostback('dgbookings$ctl00$ctl08','')">submit...</a></span> <a class="editadults" href="#" onclick="return false">edit...</a></p> </div> </div>
basically need id of div person has clicked submit , can't figure out how.
i want put id string or session can used in submitdetails
sub
any ideas
thanks
jamie
update
here's sub command how add command name/command arguement this?
sub submitdetails(byval sender object, byval e eventargs) dim strpassedtext = commandargument dim logdata2 sterm.markdata = new sterm.markdata() dim queryupdate string = ("update openquery (dev,'select * web_data booking_ref = ''"+ strpassedtext +"'' ') set children = '1' ") dim drsetupdate dataset = logdata2.stermq2(queryupdate) session("bookrefid") = strpassedtext loaddata() end sub
thanks far
jamie
modify repeater this:
<asp:repeater id="dgbookings" runat="server" onitemdatabound="itemdb" onitemcommand="itemcommand"> <itemtemplate> <div class="bookingscontent"> <div class="bookingdetails" id="<%# databinder.eval(container.dataitem, "booking_ref") %>"> <p class="infotext"><%# databinder.eval(container.dataitem, "adults") %> <asp:linkbutton onclick="editdetails" text="edit..." runat="server"></asp:linkbutton></p> <p class="infotext"><asp:linkbutton onclick="submitdetails" text="submit..." runat="server" commandname="submitdetails" commandargument="<%# databinder.eval(container.dataitem, "booking_ref") %>"></asp:linkbutton></p> </div> </div> </itemtemplate> <asp:repeater>
i added commandargument linkbutton. use item_command event of repeater see argument (in e.commandargument). this:
sub submitdetails(byval sender object, byval e repeatercommandeventargs) dim strpassedtext = e.commandargument dim logdata2 sterm.markdata = new sterm.markdata() dim queryupdate string = ("update openquery (dev,'select * web_data booking_ref = ''"+ strpassedtext +"'' ') set children = '1' ") dim drsetupdate dataset = logdata2.stermq2(queryupdate) session("bookrefid") = strpassedtext loaddata() end sub
Comments
Post a Comment