Sunday 15 June 2014

c# - Get client side HTML changes on postback -



c# - Get client side HTML changes on postback -

i want add together rows table javascript, want able find out rows on postback. there way that?

i want able populate original rows in table server (i'm thinking repeater). still possible that?

that's not much of description think covers it...

the code looks this

<table id="mytable"> <tr> <td> static row </td> </tr> <asp:repeater id="rpttest" runat="server"> <headertemplate> <tr class="dgheader"> <th> head1 </th> <th> head2 </th> <th></th> </tr> </headertemplate> <itemtemplate> <tr class="<%# (container.itemindex%2 == 0) ? "dgitem" : "dgalternatingitem" %>"> <td><%# eval("val1") %> </td> <td><%# eval("val2") %> </td> <td><a class="dgdeletebutton" href="javascript:delete(this)"></a></td> </tr> </itemtemplate> </asp:repeater> </table>

at moment i'm wondering how, server side, can version of table has whatever changes made client side.

in order info client in manner describe, need include field in form submit.

you want hidden(s) field. time add together row, either add together hidden field each value want capture (such val1 , val2) or have 1 hidden field, , when add together row, append info want existing row.

i warn against posting straight html, need values not total markup, , don't want sanitize html , parse info want.

so head start can add together hidden inputs:

<tr class="<%# (container.itemindex%2 == 0) ? "dgitem" : "dgalternatingitem" %>"> <input type="hidden" name="row[1].val1" value="myvalue" /> <td><%# eval("val1") %> </td> <input type="hidden" name="row[1].val2" value="myvalue" /> <td><%# eval("val2") %> </td> <td><a class="dgdeletebutton" href="javascript:delete(this)"></a></td> </tr>

you can submitted values on backend:

httpcontext.current.request.form["row[1].val1"]

this memory, line above might not correct.

c# asp.net .net

No comments:

Post a Comment