I have a form name called job Creation and another one is a JobCreation Popup
In Job Creation i have Add button, Some text boxes and a gridview
when i click this add button
it will show a Popup Which has two button.
One button is
Direct job And the other one is
FromQuote
When i click a quote it will show a gridview with Quote details which has
JobNo,etc
When i select the gridview the Popup should be closed and the row should be populated
in the gridview of the Parent form. Lets take both has same column. but is not so
This is My code behind
string EnqNo = string.Empty;
string QuoteNo = string.Empty;
string JobNo = string.Empty;
string ShipType = string.Empty;
string CorgoType = string.Empty;
string CustCode = string.Empty;
string CustName = string.Empty;
string CustBranchCode = string.Empty;
string CustBranchName = string.Empty;
if (grdJobRegister.SelectedRow != null)
{
if (grdJobRegister.SelectedRow.Cells[1].Text != null)
{
EnqNo = grdJobRegister.SelectedRow.Cells[1].Text;
}
if (grdJobRegister.SelectedRow.Cells[2].Text != null)
{
QuoteNo = grdJobRegister.SelectedRow.Cells[2].Text;
}
if (grdJobRegister.SelectedRow.Cells[3].Text != null)
{
JobNo = grdJobRegister.SelectedRow.Cells[3].Text;
}
if (grdJobRegister.SelectedRow.Cells[4].Text != null)
{
ShipType = grdJobRegister.SelectedRow.Cells[4].Text;
}
if (grdJobRegister.SelectedRow.Cells[5].Text != null)
{
CorgoType = grdJobRegister.SelectedRow.Cells[5].Text;
}
if (grdJobRegister.SelectedRow.Cells[6].Text != null)
{
CustCode = grdJobRegister.SelectedRow.Cells[6].Text;
}
if (grdJobRegister.SelectedRow.Cells[7].Text != null)
{
CustName = grdJobRegister.SelectedRow.Cells[7].Text;
}
if (grdJobRegister.SelectedRow.Cells[8].Text != null)
{
CustBranchCode = grdJobRegister.SelectedRow.Cells[7].Text;
}
if (grdJobRegister.SelectedRow.Cells[9].Text != null)
{
CustBranchName = grdJobRegister.SelectedRow.Cells[7].Text;
}
ClientScript.RegisterStartupScript((typeof(GridView)), "JavaScript", "GetGridValue('" + EnqNo + "','" + QuoteNo + "','" + JobNo + "','" + ShipType + "','" + CorgoType + "','"+CustCode+"','"+CustName+"','"+CustBranchCode+"','"+CustBranchName+"');",true);
This is my javaScript.
I could able to put values to textboxes but i want to put this in gridview
function GetGridValue(EnqNo,QuoNo,JobNo,ShipType,CorgoType,CustCode,CustName, CustbranchCode, CustBranchName)
{
var f= document.forms("frmjobCreation");
window.opener.document.frmjobCreation.txtEnquiryNo.value=EnqNo;
window.opener.document.frmjobCreation.txtQuoteNo.value=QuoNo;
window.opener.document.frmjobCreation.txtJobNo.value=JobNo;
window.opener.document.frmjobCreation.txtJobCustomerCode.value=CustCode;
window.opener.document.frmjobCreation.txtJobCustomerName.value=CustName;
window.opener.document.frmjobCreation.txtConsigneeCode.value=CustCode;
window.opener.document.frmjobCreation.txtConsigneeName.value=CustName;
window.opener.document.frmjobCreation.txtConsigneeBranchCode.value=CustbranchCode
window.opener.document.frmjobCreation.txtConsigneeBranchName.value=CustBranchName;
if(ShipType=='Sea')
{
var f = window.opener.document.forms("frmjobCreation");
var radioButtonList=f.elements["rbShipmentType"];
radioButtonList[0].checked=true;
}
if(ShipType=='Air')
{
var f = window.opener.document.forms("frmjobCreation");
var radioButtonList=f.elements["rbShipmentType"];
radioButtonList[0].checked=true;
}
if(CorgoType=='Freehand')
{
var f = window.opener.document.forms("frmjobCreation");
var radioButtonList=f.elements["rbFreeHandorNominatedCorgo"];
radioButtonList[0].checked=true;
}
if(CorgoType=='Nominated')
{
var f = window.opener.document.forms("frmjobCreation");
var radioButtonList=f.elements["rbFreeHandorNominatedCorgo"];
radioButtonList[1].checked=true;
}
self.close();
}