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

    GridView Enable and Disable

    Hi Guys,

    I have one GridView Loaded with 7 rows of Data's from Backend table. The Data are Loaded in corresponding cells with Lable controls. Each having Specific Lable controls. Each Row having Specfic Button with the name of GO. And Also im having another two buttons in my form page. While Cliking my First Button(OK) the GridView's first column will be enable. After that enabled while cliking GO button in grid it will run a sp. after that finished i have to click my second button in form(Conform) means, 1st row of Grid will be disable and 2nd Row will be enable. Same thing going held on towards the Last step of the Grid. KInldy guide mento do this.
  • #763352
    You have to implement this logic using

    JQuery Ajax and Javascript.

    By Nathan
    Direction is important than speed

  • #763354

    by default kept the Go button is invisible and when you click OK button then enable first row button alone and disable the OK button, refer below sample

    protected void btnOK_click(object sender, EventArgs e)
    //rebind your grid

    on rowdatabound event of gridview based on ViewState value enable the Go button for respective index.

    protected void gv_OnRowDataBound(object sender, GridviewRowEventArgs e)
    int actualIndex=e.Row.RowIndex;
    int diffIndex=Convert.ToInt32(ViewState["Index"].ToString());

    On RowDatabound event I compare the viewstate index value with actual index value, if both the indexes are same then I enable the button control.

    After enabling when you press Go button increment the View State value and rebind you grid again.

    I didn't text this, I given you the way to achieve, this is one of the way you can do it in no of ways, depend upon your interest you can implement in client side also.

    Hope this will helpful to you...

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • #763420
    You can also set Read only attribute

    <asp:BoundField DataField="UserId"
    HeaderText="User ID"/>

    Thanks & Regards
    Anil Kumar Pandey
    Microsoft MVP, DNS MVM

Sign In to post your comments