Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
Pls Help me Very Quickely, I am in lot of problem.Thanks in advance.
I want hedaer value in select index changed event.
 protected void Grid_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            lblid.Text = Grid.SelectedRow.Cells[0].Text;
            
               // Grid.SelectedRow.Cells[1].Text = "B";
            lblid1.Text = Grid.SelectedRow.Cells[1].Text;
           
        }
        catch (Exception ex)
        {
            lblmsg.Text = "Error! " + ex.Message;
        }
    }
My grid View Code behind is
 <asp:GridView ID="Grid" runat="server" EmptyDataText="No Record Found." PageSize="30"
                        AllowPaging="True" AutoGenerateColumns="False" AllowSorting="True" DataKeyNames="id" 
                        CssClass="grid" Width="100%" 
                        onselectedindexchanged="Grid_SelectedIndexChanged" 
                        onselectedindexchanging="Grid_SelectedIndexChanging">
                   
                   <Columns>
                 
                 <asp:BoundField DataField="membername" HeaderText="25Memeber Name" ReadOnly="True" HeaderStyle-Width="80px" />
 
                <asp:CommandField ButtonType="Image" HeaderText="B" NewText="B"
                            SelectImageUrl="~/resources/images/icons/tick_circle.png" 
                           ShowSelectButton="True" >
                             <HeaderStyle Width="90px" />
                       </asp:CommandField>
                             <asp:CommandField ButtonType="Image" 
                            SelectImageUrl="~/resources/images/icons/tick_circle.png" ShowSelectButton="True" HeaderStyle-Width="90px" /> 
                            <asp:CommandField ButtonType="Image" 
                            SelectImageUrl="~/resources/images/icons/tick_circle.png" ShowSelectButton="True" HeaderStyle-Width="90px" /> 
                            <asp:CommandField ButtonType="Image" 
                            SelectImageUrl="~/resources/images/icons/tick_circle.png" ShowSelectButton="True" HeaderStyle-Width="90px" /> 
                            <asp:CommandField ButtonType="Image" 
                            SelectImageUrl="~/resources/images/icons/tick_circle.png" ShowSelectButton="True" HeaderStyle-Width="90px" /> 
                            <asp:CommandField ButtonType="Image" 
                            SelectImageUrl="~/resources/images/icons/tick_circle.png" ShowSelectButton="True" HeaderStyle-Width="90px" /> 
                            <asp:CommandField ButtonType="Image" 
                            SelectImageUrl="~/resources/images/icons/tick_circle.png" ShowSelectButton="True" HeaderStyle-Width="90px" /> 
                            <asp:CommandField ButtonType="Image" 
                            SelectImageUrl="~/resources/images/icons/tick_circle.png" ShowSelectButton="True" HeaderStyle-Width="90px" /> 
                            <asp:CommandField ButtonType="Image" 
                            SelectImageUrl="~/resources/images/icons/tick_circle.png" ShowSelectButton="True" HeaderStyle-Width="90px" />
                   
                    
 
                  
 
                    </Columns>
                    <EditRowStyle BackColor="White" />
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="white" Font-Bold="True" ForeColor="Black" Font-Size="Medium" CssClass="content-box-header" />
 
                <PagerSettings Mode="NumericFirstLast"></PagerSettings>
 
                <PagerStyle CssClass="cssPager" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                </asp:GridView>
Posted 28-Dec-12 1:47am
Edited 28-Dec-12 1:48am
v2

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

  Print Answers RSS
0 OriginalGriff 324
1 Sergey Alexandrovich Kryukov 182
2 Maciej Los 159
3 Hard_Rockz 143
4 Richard MacCutchan 125
0 OriginalGriff 5,374
1 Sergey Alexandrovich Kryukov 4,713
2 Peter Leow 2,944
3 DamithSL 2,465
4 Maciej Los 2,270


Advertise | Privacy | Mobile
Web01 | 2.8.140718.1 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid