using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Data.SqlClient; public partial class DomHost_ViewQO_Invoice : System.Web.UI.Page { string id; SqlConnection Con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString); protected void Page_Load(object sender, EventArgs e) { lblMsg.Text = ""; id = Request.QueryString["ID"].ToString(); if (!IsPostBack) { string QO = "select SrNo,QOID,Convert(varchar(15),Date,101) as Date from MstQuotation where ClientName='" + id + "'"; SqlDataAdapter daQO = new SqlDataAdapter(QO, Con); DataTable dtQO = new DataTable(); daQO.Fill(dtQO); if (dtQO.Rows.Count == 0) { lblMsg.Text = "No Quotation avaliable"; btnCreate.Visible = false; } else { grdListOfQO.DataSource = dtQO; grdListOfQO.DataBind(); btnCreate.Visible = true; } btnCreate.Attributes.Add("onclick", "javascript:GetRowValue('" + QOID + "')"); } } string QOID; protected void btnCreate_Click(object sender, EventArgs e) { for (int i = 0; i < grdListOfQO.Rows.Count; i++) { CheckBox chkGrd = (CheckBox)grdListOfQO.Rows[i].FindControl("CheckBox1"); if (chkGrd.Checked == true) { Label OQNO = (Label)grdListOfQO.Rows[i].FindControl("lblQO"); QOID = OQNO.Text; } } Response.Redirect("CreateInvoice.aspx"); // Session["QuotationID"] = QOID; //Response.Write(""); //if ((e.Row.RowType == DataControlRowType.DataRow)) //{ // LinkButton linkbut = (LinkButton)e.Row.FindControl("lbairwaybillno"); // Label lb = (Label)e.Row.FindControl("lblAgent"); // Label lb1 = (Label)e.Row.FindControl("lblcust"); // //Label lb = (Label)e.Row.FindControl("lblAgent") //((LinkButton)e.Row.FindControl("lbairwaybillno")).Attributes.Add("onclick", "javascript:GetRowValue('" + linkbut.Text + "','" + lb.Text + "','" + lb1.Text + "')"); // //((LinkButton)e.Row.FindControl("lbairwaybillno")).Attributes.Add("onclick", "javascript:GetRowValue('" + lb.Text + "')"); //} } protected void CheckBox1_CheckedChanged(object sender, EventArgs e) { //Clear the existing selected row foreach (GridViewRow oldrow in grdListOfQO.Rows) { ((CheckBox)oldrow.FindControl("CheckBox1")).Checked = false; } //Set the new selected row CheckBox rb = (CheckBox)sender; GridViewRow row = (GridViewRow)rb.NamingContainer; ((CheckBox)row.FindControl("CheckBox1")).Checked = true; } }