public DataSet Ds { get { object temp = ViewState["Ds"]; return temp == null ? null : temp as DataSet; } set { ViewState["Ds"] = value; } } public void gridCustBind(int pageIndex) { try { //open the db connection if it is closed... if (connection.State == ConnectionState.Closed) connection.Open(); command = new SqlCommand(); command.CommandText = "sp_Get_CustInfoSerach"; command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.AddWithValue("@PageIndex", pageIndex); command.Parameters.AddWithValue("@PageSize", int.Parse(ddlPaging.SelectedValue)); command.Parameters.Add("@RecordCount", SqlDbType.Int, 4); command.Parameters["@RecordCount"].Direction = ParameterDirection.Output; //SqlParameter outParam = command.Parameters.Add("@bal", SqlDbType.Float); //outParam.Direction = ParameterDirection.Output; command.Parameters.Add("@bal", SqlDbType.Int, 4); command.Parameters["@bal"].Direction = ParameterDirection.Output; SqlDataAdapter daAcc = new SqlDataAdapter(command); daAcc.Fill(Ds); } catch (Exception ex) { lblMessageCustSerach.Text = ex.Message; lblMessageCustSerach.Visible = true; } finally //Close db Connection if it is open.... { if (connection.State == ConnectionState.Open) connection.Close(); } } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack == true) { gridCustBind(1); if (gridCustomer.Rows.Count > 0) { gridCustomer.DataSource = Ds; gridCustomer.DataBind(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)