Grid view row count

4 posts, 0 answers
  1. Ganeshkumar
    Ganeshkumar avatar
    7 posts
    Member since:
    Mar 2016

    Posted 28 Mar Link to this post

    Hi,

    In my project we are replacing the grid view controls in to Rad Grid controls.

    Please let me know how to implement the below code through the Rad Grid control.

    for (int i = 0; i < gvEmployee.Rows.Count; i++)
    {
    employee = ((DropDownList)gvEmployee.Rows[i].FindControl("ddlEmployee")).SelectedValue;
    for (int j = i + 1; j < gvEmployee.Rows.Count; j++)
    {
    if (string.Compare(employee, ((DropDownList)gvLOB.Rows[j].FindControl("ddlEmployee")).SelectedValue) == 0 && employee != "--SELECT--")
    {
    DoAlert("Please select distinct " + gvHeaderemployee);
    return;
    }
    }
    if (employee != "--SELECT--")
    {
    dtemployeelocal.Rows.Add(employee);
    }
    }

    I need to check the distinct record added in my grid view on Submit button click event

     

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 29 Mar Link to this post

    Hi Ganeshkumar,

    In order to validate the data edited in the RadGrid before persisting it to the data source you can use manual CRUD operations. You should handle the UpdateCommand/InsertCommand events of the grid and validate the input. In case the new data passes validation you can update the data source.

    Check out the following online example that illustrates how you can implement manual CRUD operations in RadGrid. You can use it as a starting point in your scenario. Note that you should add validation for the updated data.



    Regards,
    Viktor Tachev
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ganeshkumar
    Ganeshkumar avatar
    7 posts
    Member since:
    Mar 2016

    Posted 30 Mar in reply to Viktor Tachev Link to this post

    Hi Viktor,

    Thanks for your prompt reply.

    But in my page we use common submit button to save all the data into DB. We are not using edit button in the Gridview.

    We are validating the Gridview data in the button click event only.

    Regards,

    Ganeshkumar

     

  5. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 04 Apr Link to this post

    Hello Ganeshkumar,

    If you would like to submit all changes in the grid with a single request you should consider enabling Batch Edit mode. In this editing mode you can handle the OnBatchEditCommand event of RadGrid and iterate through the changes. Check out the following resources that describe the functionality in more detail.



    Regards,
    Viktor Tachev
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top