Click here to Skip to main content
14,931,811 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have added the code below to Postback onkeypress. On the same Debug run, sometimes I am able to run perfectly but most other times it will skip one or two functions.

C#
protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        if ((e.Row.RowState == DataControlRowState.Edit) ||
           (e.Row.RowState == (DataControlRowState.Edit | DataControlRowState.Alternate)))
        {
             e.Row.Attributes.Add("onkeydown", "javascript:if(event.keyCode == 13) {__doPostBack('" + gv.UniqueID + "', 'Update$" +
                        e.Row.RowIndex.ToString() + "'); $('#" + Button3.UniqueID + "').click(); __doPostBack('" + gv.UniqueID + "',  'Edit$" +
                        (e.Row.RowIndex + 2).ToString() + "'); return false; }");
        }
    }
}


I am using .Net Framework 3.5 and IE11 as browser.
Posted

1 solution

What is your requirement, you want to validate some thing or you want a server call?
   

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900