Hi,
I am create one application, In Which I am using datagridview. In this I am use multiple radiobuttons. but at the time of page load it takes more time to bind data to gridview..

how to bind data to gridview quikly..

Please Help Me..

Dani AI

Generated

Quick, practical ways to reduce GridView bind time when the page has many radio buttons or heavy rows.

As described, the usual culprits are loading the full resultset every Page_Load, expensive SQL, or rendering lots of per-row server controls. was right that the binding code matters, and ’s dataset suggestion works for small sets but will be slow if you pull everything every request.

Try this checklist (measure first, then apply):

  • Measure where time is spent: DB vs server-side binding vs client render (use ASP.NET tracing, SQL Profiler, or a Stopwatch around the data fetch and around the render step).
  • Server-side paging: fetch only the rows needed for the current page instead of the whole table (use ROW_NUMBER or OFFSET/FETCH). Example SQL pattern:
    WITH CTE AS (
    SELECT ROW_NUMBER() OVER (ORDER BY SomeColumn) AS rn, Col1, Col2
    FROM MyTable
    WHERE ...
    )
    SELECT Col1, Col2
    FROM CTE
    WHERE rn BETWEEN ((@PageIndex-1)*@PageSize)+1 AND (@PageIndex*@PageSize)
  • Reduce payload: SELECT explicit columns (no SELECT *), add proper indexes, and use stored procedures for tuned plans.
  • Lighter data structures: prefer a forward-only reader or an IEnumerable<T>/DataTable to avoid large DataSet overhead.
  • Disable unnecessary ViewState and heavy row controls:
    <asp:GridView ID="GridView1" runat="server" EnableViewState="false" AllowPaging="true" PageSize="20">
  • Reduce per-row server controls: avoid an ASP.NET RadioButton per cell with AutoPostBack turned on. Use client-side selection (JS) and a single postback, or use a Repeater/HTML markup for lighter HTML.
  • Cache results short-term if data is stable (Cache/MemoryCache) to avoid repeated DB hits.

Most effective combo: server-side paging + query/index tuning + removing heavy per-row controls. Measure before/after to verify improvements.

Recommended Answers

All 2 Replies

Member Avatar for Member #905211

Hard to say without see your code. Can you give of some of the code, especially where you get the data and where you bind the data.

Simply you can bind gridview using result dataset...use below code
GridViewCategory.DataSource = result.ResultData;
GridViewCategory.DataBind();

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.