Click here to Skip to main content
11,478,642 members (64,648 online)
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
09hadi739
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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 205
1 F-ES Sitecore 170
2 Frankie-C 120
3 OriginalGriff 105
4 DamithSL 95
0 Sergey Alexandrovich Kryukov 7,865
1 OriginalGriff 7,341
2 Sascha Lefèvre 3,059
3 Maciej Los 2,491
4 Richard Deeming 2,335


Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 11 Jul 2013
Copyright © CodeProject, 1999-2015
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