Click here to Skip to main content
16,004,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
protected void ImgPrint_Click(object sender, ImageClickEventArgs e)
    {
        string id = treeViewChalanNo.SelectedNode.Text;
        string[] str;
        try
        {
            str = str = treeViewChalanNo.SelectedNode.Text.Split('-');
            id = str[0];
            txtChallanNo.Text = id;
            Response.Redirect("ChallanReport.aspx?ChallanNo=" + txtChallanNo.Text, false);
            Response.Redirect("ChallanReport.aspx?cnno=" + dropCNO.Text, false);

        }
        catch (Exception ex)
        {
            MessageBox.Show("Err in ImgPrint_Click(object sender, ImageClickEventArgs e)" + ex.Message + " " + txtChallanNo.Text);
        }
    }
Posted
Updated 5-Jul-11 22:44pm
v2

You need to put both query string values on to the URL at once. ?ChallanNo=xx&cnnp=yy.
 
Share this answer
 
Comments
Member 8050901 6-Jul-11 4:52am    
Response.Redirect("ChallanReport.aspx?ChallanNo ="+ txtChallanNo.Text & cnno="+dropCNO .Text ,false);
This is giving error.
C#
protected void ImgPrint_Click(object sender, ImageClickEventArgs e)
      {
            string id = treeViewChalanNo.SelectedNode.Text;
            string[] str;
            try
            {
                  str = treeViewChalanNo.SelectedNode.Text.Split('-');
                  id = str[0];
                  txtChallanNo.Text = id;
                  Response.Redirect("ChallanReport.aspx?ChallanNo="+txtChallanNo.Text+"&cnno="+dropCNO.Text"");
            }
            catch (Exception ex)
            {
                  MessageBox.Show("Err in ImgPrint_Click(object sender, ImageClickEventArgs e)" + ex.Message + " " + txtChallanNo.Text);
            }
      }


try this code hope solved your problem.

thanks
 
Share this answer
 
Comments
Member 8050901 6-Jul-11 5:06am    
Thax for this..
Now what will be the coding on page load of next page?
My code on next page is
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["ChallanNo"] != null && !IsPostBack)
{
DisplayChalanReport(Request.QueryString["ChallanNo"].ToString());

}
else if (Request.QueryString["cnno"] != null && !IsPostBack)
{
// DisplayDummyChallan(Request.QueryString["cnno"].ToString());
}
else
{
//DisplayChalanReport(ViewState["ChallanNo && cnno"].ToString());

}

}
private void DisplayChalanReport(string ChallanNo,string cnno)
{

// long CNo = Convert.ToInt64(CNo);

// lblCNo.Text = CNo;
string sql = "";

try
{
string constr = ConfigurationManager.ConnectionStrings["YET_DatabaseConnectionString"].ConnectionString.ToString();
SqlConnection Conn = new SqlConnection(constr);
Conn.Open();
sql = "select * from Challan where ChallanNo=" + ChallanNo;

SqlCommand cmd = new SqlCommand(sql, Conn);
SqlDataReader rd = cmd.ExecuteReader();
if (rd.Read())
{
lblChallanNo.Text = rd["ChallanNo"].ToString();
lblLorryNo.Text = rd["LorryNo"].ToString();
lblLorryMake.Text= rd["LorryMk"].ToString();
lblFrom.Text = rd["ChnFrm"].ToString();
lblDate.Text = rd["ClnDate"].ToString();
lblDriverName.Text = rd["DriverNm"].ToString();
lblTo.Text = rd["ChnTo"].ToString();
lblMobNo.Text= rd["mobno"].ToString();

DataSet ds = new DataSet();

// ds = objBilty.getGridReportForBiltyId(id);
ds = this.getGridReportForChallanNo(cnno);
GridView1.DataSource = ds;
GridView1.DataBind();

}
Conn.Close();
}
catch (Exception ex)
{
MessageBox.Show("Err in DisplayBiltyReport(string ChallanNo)" + ex.Message + ChallanNo);
}
}
//private void DisplayDummyChallan(string cnno)
//{
// DataSet ds = new DataSet();

// // ds = objBilty.getGridReportForBiltyId(id);
// ds = this.getGridReportForChallanNo(cnno);
// GridView1.DataSource = ds;
// GridView1.DataBind();
//}
public DataSet getGridReportForChallanNo(string cnno)
{

string sql = "";
string Constr = ConfigurationManager.ConnectionStrings["YET_DatabaseConnectionString"].ConnectionString.ToString();

SqlConnection conn = new SqlConnection(Constr);
DataTable dt = new DataTable();
DataSet ds = new DataSet();
try
{
conn.Open();
sql = "SELECT cnno, TotPkgs, particlr, weight, toPay, paid, tbb, remark, paidDetails FROM tabDummychalan where cnno=" + cnno;
//sql = "SELECT NoOfPackages, Particulars,ActualWt,ChargedWt, RatePerKg, Freight, Hamali, PayDetails, SC_Charges, Misc, TS_Tax, Total, PaidBy FROM Bilty where (CNo=" + lIncomingBiltyCNo + ")";
SqlCommand cmd = new SqlCommand(sql, conn);
dt.Load(cmd.ExecuteReader());
ds.Tables.Add(dt);

}


catch (Exception ex)
{
MessageBox.Show("ERR In getGridReportForChallanNo(string ChallanNo)" + ex.Message + cnno);
}
finally
{

conn.Close();

}
return ds;

}
Member 8050901 6-Jul-11 5:17am    
Please tell me the ans for this

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