views:

37

answers:

0

Hi, have this weird problem with the first click of a row item in a gridview where it doesnt fire. Im loading up a user control dynamically into a placeholder. After the first click fails, subsequent clicks are fine, and the RowCommand event fires.

Any suggestions appreciated

    protected void Page_Load(object sender, EventArgs e)
    {
        this.PreRender += new EventHandler(Group_PreRender);
        this.Init +=new EventHandler(Group_Init);
        AttachEvents();

        if (Page.IsPostBack)
        {
            GetData();

        }
        else
        {
            gvName.DataBind();
        }

    }


    private void AttachEvents()
    {
        gvName.RowCommand += new GridViewCommandEventHandler(gvName_RowCommand);
    }
    protected void gvName_RowCommand(object sender, GridViewCommandEventArgs e)
    {
             //code here
    }

also tried adding the event in the markup

       <asp:Button ID="btnDisable" runat="server" CommandArgument="<% # Container.DataItemIndex %>" Visible="<%# ((EducateMe.BaseTypes.AbstractLink)Container.DataItem).IsActive == true %>" CommandName="Disable" ToolTip="Disable" Text="Apply" />

Update: This has been solved here http://stackoverflow.com/questions/4034644/itemcommand-not-firing-on-first-click-in-repeater-or-gridview