protected void MakeEmptyGridView() { ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); GridViewHAWB.DataSource = ds.Tables[0].DefaultView; GridViewHAWB.DataBind(); int columnCount = GridViewHAWB.Rows[0].Cells.Count; GridViewHAWB.Rows[0].Cells.Clear(); GridViewHAWB.Rows[0].Cells.Add(new TableCell()); GridViewHAWB.Rows[0].Cells[0].ColumnSpan = columnCount; GridViewHAWB.Rows[0].Cells[0].Text = "No HAWB Records Found."; GridViewHAWB.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center; HEmpty.Value = "Y"; }
protected void BindGridView() { string sqlText = "select a.shipper_name,a.shipper_account_number as shipper_account_number,c.owner_email as shipper_email,a.consignee_name,ISNULL(a.Consignee_acct_num,'0') as Consignee_num,e.owner_email as consignee_email,a.MAWB_num as mawbNum,a.HAWB_num as HAWB_num,d.dba_name as AgentName, a.ci as Nsubject,b.File# as FileNo from HAWB_Master a left join organization c on (a.elt_account_number=c.elt_account_number and a.shipper_account_number = c.org_account_number) left join organization e on (a.elt_account_number=e.elt_account_number and Consignee_name = e.dba_name) left join agent d on (a.elt_account_number=d.elt_account_number) left join MAWB_number b on (a.elt_account_number=b.elt_account_number and a.MAWB_num = b.MAWB_no and b.is_dome ='Y') where a.elt_account_number=" + elt_account_number + " AND a.is_dome = 'Y' and a.shipper_account_number <> ''"; if (search_type == "HAWB") { sqlText = sqlText + " and a.hawb_num='" + search_no + "'"; } else if (search_type == "MAWB") { sqlText = sqlText + " and a.mawb_num='" + search_no + "'"; } else { sqlText = sqlText + " and b.file#='" + search_no + "'"; } string FileSQL = "select elt_account_number,cast(org_no as nvarchar(16)) as org_no,file_name,file_size,file_type,file_checked,in_dt from user_files where elt_account_number=" + elt_account_number; MakeDataSet("HAWBList", sqlText); MakeDataSet("FileList", FileSQL); FormatDataSet("HAWBList"); FormatDataSet("FileList"); // SQL TEST //////////////////////////////////////// if (ds.Tables[0].Rows.Count == 0) { MakeEmptyGridView(); } else { HEmpty.Value = "N"; if (ds.Tables["HAWBList"].Rows.Count == 0) { MakeEmptyGridView(); } else { GridViewHAWB.PageSize = maxRows; GridViewHAWB.DataSource = ds.Tables["HAWBList"].DefaultView; GridViewHAWB.DataBind(); //import email ID for (int i = 0; i < GridViewHAWB.Rows.Count; i++) { Repeater FileRepeater = (Repeater)GridViewHAWB.Rows[i].FindControl("repeaterUploadFile"); string CBID = ""; string MID = ((CheckBox)GridViewHAWB.Rows[i].FindControl("MainCheckBox")).ClientID; string ID = ((HiddenField)GridViewHAWB.Rows[i].FindControl("hOrgNo")).ClientID; string ShipperEmail = ((TextBox)GridViewHAWB.Rows[i].FindControl("Txtshipper_email")).ClientID; string ID2 = ((HiddenField)GridViewHAWB.Rows[i].FindControl("hConsigneeID")).ClientID; string ConsigneeEmail = ((TextBox)GridViewHAWB.Rows[i].FindControl("Txtconsignee_email")).ClientID; string ShipperName = ((TextBox)GridViewHAWB.Rows[i].FindControl("txtShipper_Name")).ClientID; string ConsigneeName = ((TextBox)GridViewHAWB.Rows[i].FindControl("txtConsignee_name")).ClientID; string CCEmail = ((TextBox)GridViewHAWB.Rows[i].FindControl("TxtCC")).ClientID; string EmailSubject = ((TextBox)GridViewHAWB.Rows[i].FindControl("TxtSubject")).ClientID; string EmailBody = ((TextBox)GridViewHAWB.Rows[i].FindControl("txtBody")).ClientID; string CheckHAWB = ((CheckBox)GridViewHAWB.Rows[i].FindControl("HAWBCheckBox")).ClientID; string FileID = ((Repeater)GridViewHAWB.Rows[i].FindControl("repeaterUploadFile")).ClientID; string Uimage = ((ImageButton)GridViewHAWB.Rows[i].FindControl("ImagU")).ClientID; string ATTFILE = ((FileUpload)GridViewHAWB.Rows[i].FindControl("fileShipperAttachment")).ClientID; string Repnid = FileRepeater.ClientID; //((TextBox)GridViewHAWB.Rows[i].FindControl("Txtshipper_email")).Attributes.Add("onblur", "changeShipperEmail(" + ((TextBox)GridViewHAWB.Rows[i].FindControl("Txtshipper_email")).ClientID + "," + ID + ")"); //((TextBox)GridViewHAWB.Rows[i].FindControl("Txtconsignee_email")).Attributes.Add("onblur", "changeConsigneeEmail(" + ((TextBox)GridViewHAWB.Rows[i].FindControl("Txtconsignee_email")).ClientID + "," + ID2 + ")"); ((ImageButton)GridViewHAWB.Rows[i].FindControl("Image1")).Attributes.Add("onClick", "changeShipperEmail(" + ShipperEmail + "," + ID + ")"); ((ImageButton)GridViewHAWB.Rows[i].FindControl("Image2")).Attributes.Add("onClick", "changeConsigneeEmail(" + ConsigneeEmail + "," + ID2 + ")"); for (int Rep_index = 0; Rep_index < FileRepeater.Items.Count; Rep_index++) { CBID = ((CheckBox)FileRepeater.Items[0].FindControl("checkItem")).ClientID; } ((CheckBox)GridViewHAWB.Rows[i].FindControl("MainCheckBox")).Attributes.Add("onClick", "BlockEmailRow(" + ((CheckBox)GridViewHAWB.Rows[i].FindControl("MainCheckBox")).ClientID + "," + ShipperEmail + "," + ConsigneeEmail + "," + ConsigneeName + "," + ShipperName + "," + CCEmail + "," + EmailSubject + "," + EmailBody + "," + CheckHAWB + "," + ATTFILE + "," + ATTFILE + ")"); CheckBox MainCheck = (CheckBox)GridViewHAWB.Rows[i].FindControl("MainCheckBox"); /* for (int Rep_index = 0; Rep_index < FileRepeater.Items.Count; Rep_index++) * { * string CBID = ((CheckBox)FileRepeater.Items[1].FindControl("checkItem")).ClientID; * //Response.Write("<script>alert('"+ CBID +"');</script>"); * //((CheckBox)GridViewHAWB.Rows[i].FindControl("MainCheckBox")).Attributes.Add("onClick", "BlockEmailRow(" + ((CheckBox)GridViewHAWB.Rows[i].FindControl("MainCheckBox")).ClientID + "," + ShipperEmail + "," + ConsigneeEmail + "," + ConsigneeName + "," + ShipperName + "," + CCEmail + "," + EmailSubject + "," + EmailBody + "," + CheckHAWB + "," + CheckHAWB + "," + CBID + ")"); * //((CheckBox)GridViewHAWB.Rows[i].FindControl("MainCheckBox")).Attributes.Add("onClick", "checkSelection(" + MID + "," + CBID + ")"); * }*/ ds.Relations.Clear(); BindRepeater(); } } //ds.Dispose(); /* if (back == "Y") * { * Response.Write("<script>window.history.back();</script>"); * }*/ } }