Click here to Skip to main content
11,926,805 members (54,452 online)
Rate this:
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 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
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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

Solution 2

Try this..

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

In code behind.....
void linkmodel_Click(Object sender, GridViewCommandEventArgs e)
int id=e.commandargument.tostring();

nopte-use proper naming conventation......

I hope it will helpfull 4 u.....

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.151126.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