Click here to Skip to main content
16,018,394 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a gridview.In gridview header row I have one link button and combo box.I am selecting one value in combobox and performing events.My problem is that I want to get linkbutton control id when I perform event in combobox.There are one combobox and link button in each template field inside header row.So I want closest link button id.is it possible to do using C# code

What I have tried:

ASP.NET
 <asp:GridView ID="GridViewemp" runat="server" AllowPaging="True" class="gv"
            AllowSorting="True" onpageindexchanging="GridViewemp_PageIndexChanging" 
            BorderColor="#3399FF" BorderStyle="Groove" 
            CellPadding="1" CellSpacing="1"
            onsorting="GridViewemp_Sorting" PageSize="5" AutoGenerateColumns="False" 
            Height="10px" onselectedindexchanged="GridViewemp_SelectedIndexChanged" 
            onrowdatabound="GridViewemp_RowDataBound">
            <Columns>
             <asp:TemplateField HeaderText="E_Id ●" ControlStyle-Font-Names="Arial" SortExpression="eid" >
              <HeaderTemplate>
        <asp:LinkButton ID="linkid" runat="server" Text="E_Id ●" 
        CommandName="Sort" CommandArgument="eid"
        CssClass="RightAlign" ForeColor="Black"></asp:LinkButton>
      <br />
     <table>
      <tr>
       <td>
        <cc1:ComboBox ID="ComboBoid" runat="server" AutoCompleteMode="SuggestAppend" DropDownStyle="Simple" 
          Width="50px" AutoPostBack="true" OnSelectedIndexChanged="filter" >
              </cc1:ComboBox>
      </td>
</tr>
</table></HeaderTemplate>
            <ItemTemplate>
           <asp:Label ID="lblid" runat="server" Text='<%#Eval("eid")%>'/>
           </ItemTemplate>
<ControlStyle Font-Names="Arial"></ControlStyle>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="E_Name ●" SortExpression="ename" ShowHeader="true" >
           <HeaderTemplate>
        <asp:LinkButton ID="linkname" runat="server" Text="E_Name ●" 
        CommandName="Sort" CommandArgument="ename"
        CssClass="RightAlign" ForeColor="Black"></asp:LinkButton>
      <br />
     <table>
      <tr>
       <td>
        <cc1:ComboBox ID="ComboBoxname" runat="server" AutoCompleteMode="SuggestAppend" DropDownStyle="Simple" 
          Width="50px" OnSelectedIndexChanged="filter" AutoPostBack="true" >
              </cc1:ComboBox>
      </td>
</tr>
</table></HeaderTemplate>
            <ItemTemplate>
           <asp:Label ID="lblname" runat="server" Text='<%#Eval("ename")%>' />
           </ItemTemplate>
          </asp:TemplateField>
</Columns>
            <HeaderStyle Font-Names="Times New Roman" Font-Size="Small" 
                ForeColor="Black" CssClass="header" Wrap="False" />
        </asp:GridView>
Posted
Updated 21-Dec-16 1:51am
Comments
Suvendu Shekhar Giri 5-Dec-16 2:10am    
anything you have tried so far?

1 solution

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900