<pre lang="cs"> <strong>CommonClass.cs</strong> Error raising on this page Error: The name 'gvwBoarding' doesnot exist in current context. <strong>BusRouterHeader.aspx.cs</strong> gvwBoarding is a Gridview id in BusRouterHeader.aspx.cs page protected void btnSave_Click(object sender, EventArgs e) { string re = "Given Field is Empty"; if (ddlBusTravelsName.SelectedIndex.ToString() != "0" && txtAmount.Text != "" && txtFromCity.Text != "" && txtToCity.Text != "" && txtDepartureTime.Text != "" && txtArrivelTime.Text != "") { DoFill(); string res = CC.DoInsertBusRHeader(B); ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + res + "');", true); Clear(); <strong>CC.DoGdviewBoarding(); //I will call this method...... </strong> } else { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + re + "');", true); } } <strong>CommonClass.cs</strong> public void DoGdviewBoarding() { SqlCommand cmd; try { SqlDataAdapter sda; DataSet ds; mDbconnection = conn.GetDefaultDbConnectionString(); cmd = new SqlCommand("[DBO].[Proc_GetBoarding]", mDbconnection); cmd.CommandType = CommandType.StoredProcedure; sda = new SqlDataAdapter(cmd); ds = new DataSet(); sda.Fill(ds, "BusRouterHeaderMaster"); gvwBoarding.DataSource = ds; gvwBoarding.DataBind(); mDbconnection.Close(); } catch (Exception e) { } finally { if (cmd != null) cmd.Dispose(); cmd = null; mDbconnection.Close(); } } </pre>
<big></big>
public DataTable DoGdviewBoarding() { //line of codes }
gvwBoarding.DataSource = DoGdviewBoarding();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)