Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am developing a web application in which on one of my web form in a dropdown list box i am loading a product names concatenated with its packing size by "=" char. after selecting the product then on its selectedindex chage event i split the product and display the product name in one text box and packet size in another textbox but whenever i select product name from drop down lost box , my web page hangs out for few seconds and in below it shows some message as uploading(29%) and it process up to 100% and then reload the pages, idont under stand what happen, because of that user gets irritated

so please help why this happen

below is the code of dropdown list box

C#
string s = ddlProduct.Text;
string[] words = s.Split('=');
if (words.Length > 0)
{
txtProduct.Text = words[0].ToString();
txtPack.Text = words[1].ToString();
}

thans in advance
Posted
Updated 10-Mar-12 3:25am
v2

1 solution

It clearly indicates as performace issue. Not sure how you are splitting and loading the data from product name dropdown. It is advisable to move these filter logic to back end fine tuned stored procedure. Surely, it will improve the performance of your application.
 
Share this answer
 
Comments
Member 3931350 11-Mar-12 8:06am    
here is my complete code please just have a look on it and suggest me the changes,

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class RetPlaceOrderNew2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string OrdType = "";
if (Session["OrderType"].ToString() != null)
OrdType = Session["OrderType"].ToString();

if (OrdType == "New")
{
txtOrderdt.Text = DateTime.Now.Date.ToString("dd/MM/yyyy");

ddlWholeSaler.DataSource = Commanclass.returnData("Select CompanyName,RegId from RegstrationDet where Category='WholeSale'");
ddlWholeSaler.DataTextField = "CompanyName";
ddlWholeSaler.DataValueField = "RegId";
ddlWholeSaler.DataBind();

ddlWholeSaler.Items.Add("--Select WholeSaler--");
ddlWholeSaler.Items[ddlWholeSaler.Items.Count - 1].Value = "";
ddlWholeSaler.SelectedIndex = ddlWholeSaler.Items.Count - 1;

}
else
{
DataTable dt = new DataTable();
txtID.Text = Session["OrdId"].ToString();
txtOrderdt.Text = Session["OrdDate"].ToString();
dt = Commanclass.returnData("Select CompanyName,RegId from RegstrationDet where Category='WholeSale' and companyname='" + Session["OrdWhName"].ToString() + "'");
ddlWholeSaler.DataSource = dt;
ddlWholeSaler.DataTextField = "CompanyName";
ddlWholeSaler.DataValueField = "RegId";
ddlWholeSaler.DataBind();

ddlWholeSaler.Items.Add("--Select WholeSaler--");
ddlWholeSaler.Items[ddlWholeSaler.Items.Count - 1].Value = "";
ddlWholeSaler.SelectedIndex = ddlWholeSaler.Items.Count - 1;
Panel2.Visible = true;
if (dt.Rows.Count > 0)
{
DataRow dr = dt.Rows[0];
FillWhOrderGrid(txtOrderdt.Text, Convert.ToInt32(dr[1].ToString()));
}
}
}
}
private void FillWhOrderGrid(string ordDate, int Whname)
{
SqlDataAdapter sqlDa;
SqlConnection SqlCon = DAL.GetConnectionString();
DataSet ds;
string sql = "";
try
{
//String.Format("{0:yyyy-MMM-dd}", DateTime.Now.Date)
sql = "SELECT RetailerOrder.OrderId, RetailerOrder.OrderDate, RetailerOrder.WhProdCode, RetailerOrder.Product, RetailerOrder.Packsize, RetailerOrder.Qty,RegstrationDet.CompanyName,Rate,Amount FROM RetailerOrder INNER JOIN RegstrationDet ON RetailerOrder.wholeSalerId = RegstrationDet.RegId where OrderDate='" + Convert.ToDateTime(ordDate).ToString("yyyy-MM-dd HH:mm:ss") + "' and RetailerId='" + Convert.ToString(Session["regid"]) + "' and wholesalerid=" + Whname + "";
Gridview1.DataSource = Commanclass.returnData(sql);
Gridview1.DataBind();

//dgOrder.DataSource = Commanclass.returnData(sql);
//dgOrder.DataBind();

sqlDa = new SqlDataAdapter(sql, SqlCon);
ds = new DataSet();
sqlDa.Fill(ds, "Suppliers");
//dgOrder.DataSource = ds.Tables["Suppliers"];
//dgOrder.DataBind();
}
catch (Exception er) { throw er; }
}
private void FillGrid(string ordDate)
{
SqlConnection SqlCon = DAL.GetConnectionString();
string sql = "";
try
{

//String.Format("{0:yyyy-MMM-dd}", DateTime.Now.Date)
sql = "SELECT RetailerOrder.OrderId, RetailerOrder.OrderDate, RegstrationDet.CompanyName, RetailerOrder.Product, RetailerOrder.Packsize, RetailerOrder.Qty,whProdCode,Rate,Amount FROM RetailerOrder INNER JOIN RegstrationDet ON RetailerOrder.wholeSalerId = RegstrationDet.RegId where OrderDate='" + Convert.ToDateTime(ordDate).ToString("yyyy-MM-dd HH:mm:ss") + "' and RetailerId=" + Convert.ToString(Session["regid"]) + " order by Product";
Gridview1.DataSource = Commanclass.returnData(sql);
Gridview1.DataBind();
//for (int i = 0; i < Gridview1.Rows[0].Cells.Count; i++)
//{
// Gridview1.Rows[0].Cells[i].Width = Unit.Pixel(200);
//}

}
catch (Exception er) { throw er; }
}
protected void ddlWholeSaler_SelectedIndexChanged(object sender, EventArgs e)
{
lblMsg.Text = "";
try
{

LoadProductPacksize();

string msg = Convert.ToString(Commanclass.returnData("select TextMessage from dbo.Message where RegId =" + ddlWholeSaler.SelectedValue + " and Approved=1").Rows[0]["TextMessage"]);
lblMsg.Text = "Message Fro

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