hi Frd.,
i have done web page which will add values to the gridview once we select the add button it will open the popup after entering the pop-up it should display values in parent page once we return... But its not displaying
just have look guys and solve the problems as soon as possible
Default.aspx
have used two hidden fields and they are hdn1 and hdn2 and gridview i didnt add the columns directly to add gridview every things is done in programmatically
public partial class _Default : System.Web.UI.Page
{
DataSet ds = new DataSet();
public string datatablename = "empdata";
DataTable dt;
DataView dv;
DataRow dr;
DataColumn dc;
public string dc0,dc1,dc2;
protected void Page_Load(object sender, EventArgs e)
{
designcols();
Button1.Attributes.Add("onclick", "window.open('Default2.aspx',null,'left=400px,top=400,height=100px,width-250,status=no,resizable=no,scrollbars=no;toolbar=no,location=no,menubar=no');");
loadval();
}
public void designcols()
{
dt = new DataTable(datatablename);
dc = dt.Columns.Add("EMP", typeof(string));
dt.Columns.Add("empname",typeof(string));
dt.Columns.Add("Empaddr", typeof(string));
ds.Tables.Add(dt);
//dr = dt.NewRow();
//ds.Tables[datatablename].Rows.Add(dr);
}
public void loadval()
{
if (ViewState["datatablename"] != null)
{
DataTable Tempdt = new DataTable();
Tempdt = ViewState["datatablename"] as DataTable;
dt = Tempdt.Copy();
}
dr = dt.NewRow();
dr[0] = hdn1.Value;
dr[1] = hdn2.Value;
dr[2] = dc2;
dt.Rows.Add(dr);
ViewState["datatablename"] = dt;
dv = new DataView(dt);
GridView1.DataSource = dv;
GridView1.DataBind();
}
Default2.aspx in html page i wrote this
Two textbox as textbox1 and textbox2
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
function passvalue()
{
window.opener.document.getElementById("hdn1").value=document.getElementById("<%=TextBox1.ClientID %>").value;
window.opener.document.getElementById("hdn2").value=document.getElementById("<%=TextBox2.ClientID %>").value;
window.self.close();
}
</script>
</head>
in page load i have added this
protected void Page_Load(object sender, EventArgs e)
{
Button1.Attributes.Add("onclick", "passvalue();");
}
check this code or mail me i will send u back the Webpage which i have errors....
Never Give Up