Reputation: 3945
using ASP.NET I use a repeater to displaying a DB table on screen.
I want the user to be able to check or uncheck a tick box(field in the table). Updating the corresponding field in the DB in Management Studio on real time.....
Looking through google. JQuery seems the way....so far I have got...
in code behind:
//GetUtilityCompanyNames() returns a list of all the companies names
rptSelectedUtilities.DataSource = GetUtilityCompanyNames();
rptSelectedUtilities.DataBind();
In aspx:
<asp:Repeater id="rptSelectedUtilities" runat="server" DataSourceID="rptSelectedUtilities">
<HeaderTemplate>
<table class="detailstable FadeOutOnEdit">
<tr>
<th style="width:200px;">Utility</th>
<th style="width:200px;">Contacted</th>
<th style="width:200px;">Comment</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<th style="width:200px;"><%# Eval("Name") %></th>
<th style="width:200px;"><asp:CheckBox ID="chkMyCheck" runat="server" Checked='<%# Convert.ToBoolean(Eval("Checked")) %>'/></th>
<th style="width:200px;"><%# Eval("Comment") %></th>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<asp:Label id="labelTableEmpty" runat="server" Text="There are currently no items in this table." />
<script type="text/javascript">
$('bla').
//dont kno how to start here??
I've set the DataSourceID on the repeater to="rptSelectedUtilities", then i need to add in the Script but I am a beginner at this and would appreciate any help please.
Thanks
Upvotes: 1
Views: 1136