Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 30th, 2007, 11:44 PM
Registered User
Join Date: Jul 2007
Location: Kolkata, West Bengal, India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to dhurjati_sen Send a message via Yahoo to dhurjati_sen
Default Grid View in ASP.NET 2.0 Using C#

I have a grid view where i am a template field to delete a row. i want to capture the datakey value for the row.

How do i do this. Following the code:

<asp:GridView ID="gvAllEmployees" runat="server" AllowPaging="True" AllowSorting="True"
            AutoGenerateColumns="False" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None"
            BorderWidth="1px" CellPadding="4" DataKeyNames="UserID" DataSourceID="sdsAllEmployees"
            ForeColor="Black" GridLines="Vertical" HorizontalAlign="Center" Width="100%"
            PageIndex="10" PagerSettings-Mode="Numeric" EmptyDataText="There are no employee records to show."
            EmptyDataRowStyle-CssClass="labeltext" EmptyDataRowStyle-HorizontalAlign="center"
            EmptyDataRowStyle-VerticalAlign="middle" CssClass="gridview">
                <asp:HyperLinkField DataNavigateUrlFields="UserID" DataNavigateUrlFormatString="~/EmployeeDetails.aspx?UserName={0}"
                    DataTextField="UserID" HeaderText="User ID" SortExpression="UserID" />
                <asp:BoundField DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" />
                <asp:BoundField DataField="MiddleName" HeaderText="Middle Name" SortExpression="MiddleName" />
                <asp:BoundField DataField="LastName" HeaderText="Last Name" SortExpression="LastName" />
                <asp:BoundField DataField="Designation" HeaderText="Designation" SortExpression="Designation" />
                <asp:BoundField DataField="Role" HeaderText="Role" SortExpression="Role" />
                <asp:BoundField DataField="UserName" HeaderText="User Name" SortExpression="UserName" />
                        <asp:ImageButton ID="imgbtDelete" runat="server" ImageUrl="~/Images/Delete.gif" ToolTip="Delete Employee"
                            CausesValidation="false" CommandName="Delete" OnClientClick="return confirm('Pressing OK will delete this employee record. Do you wish to continue?')" />
            <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" HorizontalAlign="center" />
            <FooterStyle BackColor="#CCCC99" />
            <RowStyle BackColor="#F7F7DE" HorizontalAlign="Center" />
            <AlternatingRowStyle BackColor="White" />
            <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
            <PagerStyle HorizontalAlign="Center" CssClass="pages" />
<asp:SqlDataSource ID="sdsAllEmployees" runat="server" ConnectionString="<%$ ConnectionStrings:EmployeeTimeTrackerDBConnectionS tring %>"
    SelectCommand="GetAllEmployee" SelectCommandType="StoredProcedure" DeleteCommand="DeleteEmployee"
    DeleteCommandType="storedProcedure" DataSourceMode="DataSet"></asp:SqlDataSource>

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Grid View Paging in VB.Net Prakash001 Visual Studio 2005 0 January 30th, 2008 07:44 AM
Help Grid View Drop Down List, view all jskinner123 ASP.NET 2.0 Basics 0 November 25th, 2007 06:25 PM
Refreshing a grid in asp.net 2.0 cpanson ASP.NET 2.0 Professional 3 March 5th, 2006 12:29 AM

All times are GMT -4. The time now is 05:14 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.