G
Guest
Hello!
I am working with 2 webforms. The first webform has a 2 weborm textboxes
that I use as a placeholders. The second webform is a popup window that has a
DataGrid in it. The DataGrid has 2 columns (Vendor Name and Vendor No.) When
the user clicks at a Datagird cell, the Vendor Name and Vendor No. are passed
to the first webform's 2 textboxes. But only the Vendor Name should be
visible. I therefore changed the Vendor No. textbox's Visible property to
False. But now the Vendor No. is no longer being retrieved by the first
webform. Should I use a different control? Suggestions? Thanks in advance.
Below is the code for the second webform (popup window):
public void DataGridEventHandler( object sender, DataGridCommandEventArgs e)
{
if (e.CommandName == "Select_Vendor_No" || e.CommandName
"Select_Vendor_Name")
{
string vendorName = e.Item.Cells[1].Text;
string vendorNo = e.Item.Cells[3].Text;
vendorName = vendorName.Replace("'","\'");
string script =
"javascript
pener.document.Form1.txtVendorName.value='"+vendorName+"';opener.document.Form1.txtVendorNo.value='"+vendorNo+"';window.close();";
}
}
private void DataGrid_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
string vendorName = e.Item.Cells[1].Text;
string vendorNo = e.Item.Cells[3].Text;
vendorName = vendorName.Replace("'","\'");
string script =
"javascript
pener.document.Form1.txtVendorName.value='"+vendorName+"';
opener.document.Form1.txtVendorNo.value='"+vendorNo+"'; window.close();";
LinkButton lnk;
if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType ==
ListItemType.Item)
{
lnk = (LinkButton)e.Item.FindControl("lnkBut");
lnk.Attributes.Add("onclick", script);
}
}
Below is the code for the first webform:
private void btnSearch_Click(object sender, System.EventArgs e)
{
string vendorName = txtVendorName.Text;
string vendorNo = txtVendorNo.Text;
.........
}
I am working with 2 webforms. The first webform has a 2 weborm textboxes
that I use as a placeholders. The second webform is a popup window that has a
DataGrid in it. The DataGrid has 2 columns (Vendor Name and Vendor No.) When
the user clicks at a Datagird cell, the Vendor Name and Vendor No. are passed
to the first webform's 2 textboxes. But only the Vendor Name should be
visible. I therefore changed the Vendor No. textbox's Visible property to
False. But now the Vendor No. is no longer being retrieved by the first
webform. Should I use a different control? Suggestions? Thanks in advance.
Below is the code for the second webform (popup window):
public void DataGridEventHandler( object sender, DataGridCommandEventArgs e)
{
if (e.CommandName == "Select_Vendor_No" || e.CommandName
"Select_Vendor_Name")
{
string vendorName = e.Item.Cells[1].Text;
string vendorNo = e.Item.Cells[3].Text;
vendorName = vendorName.Replace("'","\'");
string script =
"javascript

}
}
private void DataGrid_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
string vendorName = e.Item.Cells[1].Text;
string vendorNo = e.Item.Cells[3].Text;
vendorName = vendorName.Replace("'","\'");
string script =
"javascript

opener.document.Form1.txtVendorNo.value='"+vendorNo+"'; window.close();";
LinkButton lnk;
if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType ==
ListItemType.Item)
{
lnk = (LinkButton)e.Item.FindControl("lnkBut");
lnk.Attributes.Add("onclick", script);
}
}
Below is the code for the first webform:
private void btnSearch_Click(object sender, System.EventArgs e)
{
string vendorName = txtVendorName.Text;
string vendorNo = txtVendorNo.Text;
.........
}