You must Sign In to post a response.
  • Category: ASP.NET

    GridView Selected Index changed Event

    Grid View's Selected Index Changed event does not fire in my form. can anyone tell me what are the possibilities?
  • #141671
    IN 2005 dotnet
    in U R grid press f4 and then SEE THE properties there
    is a symbal yellow color click on that select the grid
    view oage index changing
    write this code

    protected void gv_PageIndexChanging(object sender, GridViewPageEventArgs e)
    { gv.PageIndex = e.NewPageIndex;
    FillData();
    }

  • #141672
    // Selecting row

    void myGridView_SelectedIndexChanged(object sender, EventArgs e)
    {

    // This will contain the selectedValue of the row

    string selectedCategory = myGridView.SelectedRow.Cells[1].Text;

    }

  • #141675
    hi MalikaArjun,
    i have given the way you have mentioned, and also set a break point. but control doesn't go there, the event doesn't fire.... what to do

  • #141677
    can u please send ur code and the form

  • #141678
    hi MalikaArjun,
    i have given the way you have mentioned, and also set a break point. but control doesn't go there, the event doesn't fire.... what to do

  • #141681
    I have given the code part(not the whole code)


    protected void gvwIdlRate_SelectedIndexChanged(object sender, EventArgs e)
    {
    GridViewRow row = gvwIdlRate.SelectedRow;
    int iRownum = gvwIdlRate.SelectedIndex;
    }
    protected void gvwIdlRate_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
    GridViewRow row = gvwIdlRate.SelectedRow;
    }





    <asp:TemplateField HeaderText = "Add Row">
    <HeaderStyle CssClass ="gViewHeader"/>
    <asp:GridView ID="gvwIdlRate" AllowSorting="True" runat="server" CellSpacing="1" CellPadding="5" SelectedIndex="0" BorderWidth="0px" AutoGenerateColumns="False" Width = "100%" OnRowDeleting="gvwIdlRate_RowDeleting" OnRowCreated="gvwIdlRate_RowCreated" OnSelectedIndexChanged="gvwIdlRate_SelectedIndexChanged" OnSelectedIndexChanging="gvwIdlRate_SelectedIndexChanging">
    <HeaderStyle CssClass="gViewHeader" />
    <Columns > <ItemTemplate>
    <asp:ImageButton ID="btnAddNextRow" ImageUrl="../../Images/Mplus.gif" runat = "server" CommandName ="Select" OnClick = "btnAddRow_Click" />
    <asp:Label ID="lblRowCnt" runat="server" Visible="False"></asp:Label>

    </ItemTemplate>
    <ItemStyle CssClass="gViewCntd" Width = "25px" />
    </asp:TemplateField>

  • #141682
    http://www.codersource.net/asp_net_grid_view_whidbey.aspx
    go trough this this will helpful to u

  • #141683
    protected void gvwIdlRate_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
    GridViewRow row = gvwIdlRate.SelectedRow;
    Response.Redirect("Default.aspx");

    }
    Default.aspx meens where you have to redirect when u click the select


This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.