Click here to Skip to main content
15,887,954 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I wrote a code that depends on one text file. This file stores data.
I read this file & get details from it, bind it to GridView. This all process is in page_load event.
Please tell me how can i create lightweight page when page load event is called using scriptmanager & updatepanel for Gridview. Please help.

Code is in Page Load Event:-----
C#
AddressBookSearch AddressSearch = new AddressBookSearch();
string mStr = AddressSearch.GetData();
Dt = AddressSearch.processAllDetails(mStr);
try
{
   if (Dt.Rows.Count > 0 && Dt != null)
   {
     TempDt.Columns.Add("Name");
     TempDt.Columns.Add("NameUrl");
     foreach (DataRow Dr in Dt.Rows)
     {
       DataRow TempDr = TempDt.NewRow();
       if (string.IsNullOrEmpty(Dr["Title"].ToString().Trim() + Dr["First Name"].ToString().Trim() + Dr["Middle Name"].ToString().Trim() + Dr["Last Name"].ToString().Trim()) == true)
       {
         TempDr["Name"] = "(UnName)";
       }
       else
       {
         TempDr["Name"] = Dr["Title"].ToString().Trim() + " " + Dr["First Name"].ToString().Trim() + " " + Dr["Middle Name"].ToString().Trim() + " " + Dr["Last Name"].ToString().Trim();
       }
       TempDr["NameUrl"] = "Demo.aspx?Index=" + Dr["Index"].ToString();
       TempDt.Rows.Add(TempDr);
    }
    DataView TempDv = new DataView(TempDt, "", "Name", DataViewRowState.CurrentRows);
    GridView1.DataSource = TempDt = TempDv.ToTable();
    GridView1.DataBind();
}
catch{}

this code takes 352kb when i have 200 contacts i'm to see...& allowed for gridview paging.

Any help for that code to reduce kb on mobile browser.....
Please help me for that

regards
Posted
Updated 14-Apr-10 3:10am
v2

1 solution

First off, 200 contacts probably makes up a large amount of your page. The only way to reduce that text is to reduce the number of contacts.

Beyond that, Microsoft web controls can be very verbose. If you really need to cut down on the bloat, you will probably need to avoid the controls entirely and lay out the page yourself.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



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