Datagrid giving a 400 error on postback with large dataset

Discussion in 'ASP .Net Web Controls' started by Jason M, Feb 1, 2005.

  1. Jason M

    Jason M Guest

    I wont be able to post all the code because it is in a very large project.
    What I'm doing is I create a datagrid with a mixt of bound columns and custum
    columns filled with link buttons. Basically I'm using the linkbuttons to
    create a master/detail page. When the link button is click in the datagrid
    another datagrid is created and filled with data from a stored procedure.
    This works untill I start working with a very dataset that has about 10,000
    rows. If user half that data no problems. Any ideas how to work around this.

    here is a snippet of where the code for the when the LinkButton is clicked
    in the datagrid but I'm thinking this isn't the problem.

    protected void
    HG2_ItemCommand(objectsource,System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {

    string s =e.CommandArgument.ToString();
    string x=e.CommandArgument[1].ToString();
    string myConnString2 = "Password=xx;User ID=xx;Initial
    Catalog=DashBoard;Data Source=(local)";

    Label lblTitle = new Label();
    lblTitle.ID ="lblTitle";
    PCP.Controls.Add(new LiteralControl("<BR>"));
    PCP.Controls.Add(new LiteralControl("<BR>"));
    PCP.Controls.Add(lblTitle);
    PCP.Controls.Add(new LiteralControl("<BR>"));
    lblTitle.Text = e.CommandName;
    lblTitle.ForeColor = System.Drawing.Color.MediumSeaGreen;
    lblTitle.Font.Size = 14;
    lblTitle.Font.Bold = true;
    SqlConnection conn2 = new SqlConnection(myConnString2);
    conn2.ConnectionString = myConnString2;
    conn2.Open();
    SqlCommand cmd2 = conn2.CreateCommand();
    cmd2.CommandText = "[detail]";
    cmd2.CommandType = System.Data.CommandType.StoredProcedure;
    cmd2.Connection = conn2;
    DataSet ds2 = new DataSet();
    SqlDataAdapter da2 = new SqlDataAdapter(cmd2);
    da2.Fill(ds2);
    ds2.Tables[0].TableName ="detail";

    DataGrid DG1 = new DataGrid();
    DG1.ID = "DG1";
    PCP1.Controls.Add(new LiteralControl("<BR>"));
    PCP1.Controls.Add(DG1);
    DG1.GridLines = GridLines.Both;
    DG1.CellPadding =1;
    DG1.ForeColor=System.Drawing.Color.Black;
    DG1.Font.Size = System.Web.UI.WebControls.FontUnit.Smaller;
    DG1.BackColor = System.Drawing.Color.WhiteSmoke;
    DG1.HeaderStyle.BackColor = System.Drawing.Color.LightSteelBlue;


    DG1.DataSource=ds2;
    DG1.DataMember ="detail";
    DG1.DataBind();

    }
     
    Jason M, Feb 1, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dan C Douglas
    Replies:
    5
    Views:
    424
    Dan C Douglas
    Jul 22, 2003
  2. Sushil Prasad

    400 bad request error --- help

    Sushil Prasad, Jan 26, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    442
    Sushil Prasad
    Jan 26, 2005
  3. =?Utf-8?B?U2F0aHlhIHNoYW5rYXI=?=

    FIX: "HTTP 400 - Bad request" error message in the .NET Framework

    =?Utf-8?B?U2F0aHlhIHNoYW5rYXI=?=, Mar 30, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    3,915
    =?Utf-8?B?U2F0aHlhIHNoYW5rYXI=?=
    Mar 30, 2005
  4. sixteenmillion

    The giving that keeps on giving

    sixteenmillion, Nov 19, 2007, in forum: C Programming
    Replies:
    0
    Views:
    455
    sixteenmillion
    Nov 19, 2007
  5. Ketchup
    Replies:
    1
    Views:
    281
    Jan Tielens
    May 25, 2004
Loading...

Share This Page