Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
<div>
                        <ul class="ul-Clinical" style="margin-removed 5px;">
                            <asp:Repeater ID="rptAllMembers" runat="server">
                                <ItemTemplate>
                                    <li class="ul_Clinical_li1" style="margin-removed 10px; margin-removed 15px; border: 1px solid #ccc;
                                        width: 100px; height: 100px;"  önclick="clickshowtick('<%# Eval("TherapistStaffID") %>')">
                                        <div id='<%# Eval("TherapistStaffID") %>' class="">
                                        </div>
                                        <img src="../images/Avatar.png" alt="TimeSheet" style="width: 50px;" /><br />
                                        <asp:Label ID="lblUsername" runat="server" ToolTip='<%# Eval("FirstName") + " " + Eval("LastName") %>'
                                            Text='<%# Eval("FirstName") + " " + Eval("LastName") %>'></asp:Label>
                                    </li>
                                </ItemTemplate>
                            </asp:Repeater>
                        </ul>
                    </div>
 
This is my for repeater i am implementing the tick class on it of jquery.and getting id from my table.in eval id='<%# Eval("TherapistStaffID") %>'
 
<div class="DivGeneral">
                                <asp:Label ID="lblSearch" runat="server" Text="Search:" Width="50px"></asp:Label>
                                <asp:TextBox ID="txtSearch" runat="server" CssClass="sf" Width="423px">
                                </asp:TextBox>
                                <%--Hidden Field--%>
                                <asp:HiddenField ID="hfSelectedMembeID" runat="server" Value="" />
                            </div>
 
this my hidden field in which i want to put my repeater id.
 
function clickshowtick(tckclass) {
 
            if ($('#' + tckclass).hasClass("tick_img"))
                $('#' + tckclass).removeClass("tick_img");
            else
                $('#' + tckclass).addClass("tick_img");
            $("#<%=hfSelectedMembeID.ClientID %>").val(tckclass);
 
            var str;
            str = $("#<%=hfSelectedMembeID.ClientID %>").val(tckclass) + ',' + tckclass }
 
this is my javascript code at the top of my design class.
 
here is a problem that i dont know how to get the id from repeater link button on click.and after that how to put it in hidden field
 
and after that how can i get it at code behind.
at last how to store it in database.
 
please help me.
 
thxxxxxxxxxxxxxxxxxxxx
Posted 2-Jan-13 0:51am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
 
So your problem is you cant get any unique identification while user click or any other operation on that particular row.
 
You can achieve it using several way, but don't use hidden fields its not a secure.
 
before binding you can bind your auto generated id with that grid view but that column should be invisible.
 
Or
 
you can directly bind DB identity filed to that grid.
 
Or
 
Create one GUID for each row and on click asynchronously send that GUID to sever and depending on that check your data. put that GUID to a custom attribute of TR and you can get it via JQuery or javascript * recommended
 
Or
 
if your table is not sort able then you will get row index in javascript and that row index is equals to your datatables row index at server. send that index to server. (IF you not using paging) * Not recommended
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 389
1 Sergey Alexandrovich Kryukov 362
2 CPallini 130
3 Abdul Samad KP 125
4 Richard MacCutchan 110
0 OriginalGriff 6,249
1 Sergey Alexandrovich Kryukov 5,680
2 CPallini 4,850
3 George Jonsson 3,454
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 3 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100