ASP.NET - problem in grid view

Asked By Dilip Sharma
03-Feb-12 07:23 AM
I have one problem 
 i have one grid view 
which i am binding in page load...

It showing 150 rows..

Its working fine...

.........................
But when i am adding one drop down list in one column of grid view 

<asp:TemplateField HeaderText="Transaction ">
    <ItemTemplate>
    <asp:DropDownList ID="Drop_Trans" runat="server" >
    <asp:ListItem>Select Transaction Type</asp:ListItem>
    <asp:ListItem>Bank Payment</asp:ListItem>
    <asp:ListItem>Bank Receipt</asp:ListItem>
    <asp:ListItem>Purchase Payment</asp:ListItem>
    <asp:ListItem>Purchase Receipt</asp:ListItem>
    </asp:DropDownList>
    </ItemTemplate>
    </asp:TemplateField>

Then after load the page... and After DisplayThe Grid


I m not binding this Drop down  with Data Base ...
 

  my browser is hanging for fraction of time....
After That If i m clicking on any button also then .... Its Hanging for 2,3 second Then Processing...
I Not Getting Why its Happening...

Please Suggest Me...
  Reena Jain replied to Dilip Sharma
03-Feb-12 08:17 AM
Hi,

You can use paging in gridview like you can implement the click event of each linkbutton

protected void btnfirst_Click(object sender, EventArgs e)
  {
     gridview1.PageIndex = 0;
  }
 
protected void btnnext_Click(object sender, EventArgs e)
 
  {
   int i = gridview1.PageIndex + 1;
    if (i <= gridview1.PageCount)
    {
    gridview1.PageIndex = i;
   }
  }
protected void btnprevious_Click(object sender, EventArgs e)
   {
    int i = gridview1.PageCount;
    if (gridview1.PageIndex > 0)
    {
  gridview1.PageIndex = gridview1.PageIndex - 1;
 
     }
   }
refer this link
http://www.dotnetspider.com/resources/32123-Paging-for-First-Next-Previous-Last.aspx
  Dilip Sharma replied to Reena Jain
03-Feb-12 08:19 AM
but here i not want to show paging because here i m showing bank statements..

Thats why i put this in panel and give scroll ....

becuse if i show 20 row at one time ..  then it very difficult for user to use ...
  kalpana aparnathi replied to Dilip Sharma
03-Feb-12 01:32 PM
hi,

Do you check for ispostback() condition?

Please do it first ,your gridview is binded in page_load() within ispostback() like this:

if(ispostback())
{
//code for binding gridview
}

Hope will works,

Thanks,
  Dilip Sharma replied to kalpana aparnathi
03-Feb-12 02:37 PM
i m not writing a single line in page load...
my code in button click ... database intraction only one time..... 

but after that if i m clicking on any of other button .. then also browser is going to hang for a second.. 
  kalpana aparnathi replied to Dilip Sharma
04-Feb-12 11:49 AM
i m not telling you for one line code you can write multiline code within ispostback();

Thanks,
  Dilip Sharma replied to kalpana aparnathi
04-Feb-12 12:30 PM
i know....

i m clearing u.. i didn't write any thing at page load...


Create New Account
help
Net hi friends Any one send frequently asked Important questions in C# .Net, ADO .Net, Asp .Net and Sql Server. . . . . . . . tx in Advance. . . . . . Hi, Find this. . (B)What is an IL? (B A) What is scavenging? (B) What are different types of caching using cache object of ASP.NET? (B) How can you cache different version of same page using ASP.NET cache object? (A) How will implement Page Fragment Caching? (B) Can you compare ASP.NET sessions with classic ASP? (B) Which are the various modes of storing ASP.NET session
net ADO is designed primarily for connected access ADO.net the disconnected access to the database is used In ADO you communicate with the database by making calls to an OLE DB provider. In ADO.NET you communicate with the database through a data adapter (an OleDbDataAdapter, SqlDataAdapter, OdbcDataAdapter, or OracleDataAdapter object), which makes calls to or the APIs provided by the underlying data source. In ADO you cant update the database from the recordset. ADO.NET the data adapter allows you to control how the changes to the dataset are transmitted to the database. On order to get assembly info which namespace we should import? System.Reflection Namespace How Answer2 The static modifier is used to declare a static member, which belongs to the type itself rather than to a specific object. The static modifier can be used with fields security info = False;user id = sa;workstation id = IBM-6BC8A0DACEF;packet size = 4096?; String strCom1 = ”SELECT * FROM employee”; SqlDataAdapter sqlDa1 = new SqlDataAdapter(strCom1, strCon); ds1.Tables.Add(”employee”); sqlDa1.Fill(ds1 tab”) This will fill the dataset with the records starting at 5 to 15 .NET Database interview questions How do you call and execute a Stored Procedure in.NET? Give an
All" && DropDownList_state.SelectedItem.Text = = "All" && DropDownList_city.SelectedItem.Text = = "All" && CheckBoxList1.SelectedIndex = = -1) { cmd = new SqlCommand ( "select a.img, a.prop_name, b.state_name, c.city_name, d.price, d.prop_price_type, d.builtup_area, d Selected = = true && CheckBoxList1.Items[1].Selected = = false && CheckBoxList1.Items[2].Selected = = false ) { cmd = new SqlCommand ( "select a.img, a.prop_name, b.state_name, c.city_name, d.price, d.prop_price_type, d.builtup_area, d Selected = = false && CheckBoxList1.Items[1].Selected = = true && CheckBoxList1.Items[2].Selected = = false ) { cmd = new SqlCommand ( "select a.img, a.prop_name, b.state_name, c.city_name, d.price, d.prop_price_type, d.builtup_area, d Selected = = false && CheckBoxList1.Items[1].Selected = = false && CheckBoxList1.Items[2].Selected = = true ) { cmd = new SqlCommand ( "select a.img, a.prop_name, b.state_name, c.city_name, d.price, d.prop_price_type, d.builtup_area, d Selected = = true && CheckBoxList1.Items[1].Selected = = true && CheckBoxList1.Items[2].Selected = = false ) { cmd = new SqlCommand ( "select a.img, a.prop_name, b.state_name, c.city_name, d.price, d.prop_price_type, d.builtup_area, d Selected = = true && CheckBoxList1.Items[1].Selected = = false && CheckBoxList1.Items[2].Selected = = true ) { cmd = new SqlCommand ( "select a.img, a.prop_name, b.state_name, c.city_name, d.price, d.prop_price_type, d.builtup_area, d Selected = = false && CheckBoxList1.Items[1].Selected = = true && CheckBoxList1.Items[2].Selected = = true ) { cmd = new SqlCommand ( "select a.img, a.prop_name, b.state_name, c.city_name, d.price, d.prop_price_type, d.builtup_area, d Selected = = true && CheckBoxList1.Items[1].Selected = = true && CheckBoxList1.Items[2].Selected = = true ) { cmd = new SqlCommand ( "select a.img, a.prop_name, b.state_name, c.city_name, d.price, d.prop_price_type, d.builtup_area, d
Migration from ASP to ASP.net How to convert ASP site to ASP.NET site using C# http: / / www.asp.net / downloads / archived-v11 / migration-assistants / asp-to-aspnet hi, ASP.NET framework is very much different from unstrucured ASP and there is no correct way to
Tracing in ASP.NET? hi all, what is tracing? how to achieve tracing in asp.net? different ways of doing tracing? thanks and regards Aman Khan hi. . Tracing in ASP.NET 2.0 Tracing is a way to monitor the execution of your ASP.NET application. You can record exception details and program flow in a way that doesn't