Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP ASP.NET
Hi, I would like to to know if there is a way to retrieve the ID of a cell from the gridview in ASP.net C#. What I do is I bind the gridview programmatically. So I added a a template column and added check box to it via the toolbox. So what I need to do is that I need to create files by the name of a value in the GridView.
Any suggestions or help will be helped.
Posted 11-Jul-13 1:54am
09hadi710
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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

Solution 2

Try this..
 
<asp:TemplateField>
     <ItemTemplate>
         <asp:LinkButton runat="server" ID="linkmodel" Text='<%#Eval("MenuItem") %>'
                         CommandArgument='<%#Eval("CommandName") %>'
                         OnCommand="linkmodel_Click; CommandName="id"
                         OnClientClick="return confirm('Are You Sure')">
         </asp:LinkButton>
     </ItemTemplate>
</asp:TemplateField>
 

In code behind.....
void linkmodel_Click(Object sender, GridViewCommandEventArgs e)
{
if(e.CommandName=="id")
{
int id=e.commandargument.tostring();
}
}
 
nopte-use proper naming conventation......
 
I hope it will helpfull 4 u.....
  Permalink  

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



Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 11 Jul 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