One more question Dear... I have done this way..like btnOrg.OnClientClick = "window.open('Organization.aspx','mywindow','width=700,height=600')"; Now i need to write somthing...on this protected void btnOrg_Click1(object sender, EventArgs e) { //mycode for
other purpose } How it can be possible that you are using both properties of button control at same event..? And my requirement for both.... Thanx
It is our choices that show what we truly are, far more than our abilities...
Now when I select an option on radiobuttonlist then it redirects to parent form(addContacts.aspx) with the value which i have selected but on the parents form page all other fields become blank.
it suppose to like the parent page has been reset.(But the selected value from child form remain as it is; in parents form)
Should i save all parents form's control values to a temprary variable.
Or somthing else...
thanx..
It is our choices that show what we truly are, far more than our abilities...
Now when I select an option on radiobuttonlist then it redirects to parent form(addContacts.aspx) with the value which i have selected but on the parents form page all other fields become blank.
it suppose to like the parent page has been reset.(But the selected value from child form remain as it is; in parents form)
Should i save all parents form's control values to a temprary variable.
demoninside9
Participant
1182 Points
1697 Posts
Re: How to move value from one form to another
May 26, 2009 02:21 PM|LINK
The both variable, value and ids are are having same values
value variable should have a numeric value associated with ids variable...
[the value variable should have the primery key column value as ids is already having a string value corresponding to primery key]
Thanx
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: How to move value from one form to another
May 26, 2009 02:28 PM|LINK
My logic is not wrong You are binding dame data in Text and Value if you still dont agree test this
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Demo</title> <script type ="text/javascript"> function RedirectParent(tbl) { var inputs = tbl.getElementsByTagName("input"); for(var i=0;i<inputs.length;i++) { if(inputs[i].checked) { var lbl = inputs[i].parentNode.getElementsByTagName("label")[0]; window.opener.location.href ="addcontacts.aspx?id=" + encodeURIComponent(lbl.innerHTML) + "&value=" + encodeURIComponent(inputs[i].value); window.close(); } } } </script> class=tag > <body> <form id="form1" runat="server"> <div> <asp:RadioButtonList ID="RadioButtonList1" runat="server" CssClass="ver11" onclick ="RedirectParent(this)"> <asp:ListItem Text ="10" Value ="1" ></asp:ListItem> <asp:ListItem Text ="20" Value ="2" ></asp:ListItem> </asp:RadioButtonList> </div> </form> </body> </html>Contact me
demoninside9
Participant
1182 Points
1697 Posts
Re: How to move value from one form to another
May 26, 2009 02:51 PM|LINK
Oh Sorry..dear you were absolutely right. I was wrong.
i didnt set radiobutton datavalue field.
Now its working fine..
Thank you so much
demoninside9
Participant
1182 Points
1697 Posts
Re: How to move value from one form to another
May 26, 2009 03:05 PM|LINK
One more question Dear... I have done this way..like btnOrg.OnClientClick = "window.open('Organization.aspx','mywindow','width=700,height=600')"; Now i need to write somthing...on this protected void btnOrg_Click1(object sender, EventArgs e) { //mycode for other purpose } How it can be possible that you are using both properties of button control at same event..? And my requirement for both.... Thanx
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: How to move value from one form to another
May 26, 2009 03:57 PM|LINK
Yes you can it will first open the window and the execute the server side code
Contact me
demoninside9
Participant
1182 Points
1697 Posts
Re: How to move value from one form to another
May 27, 2009 10:16 AM|LINK
Hi...
your code is working fine.
Now when I select an option on radiobuttonlist then it redirects to parent form(addContacts.aspx) with the value which i have selected but on the parents form page all other fields become blank.
it suppose to like the parent page has been reset.(But the selected value from child form remain as it is; in parents form)
Should i save all parents form's control values to a temprary variable.
Or somthing else...
thanx..
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: How to move value from one form to another
May 27, 2009 10:20 AM|LINK
Save in session variables
Contact me
demoninside9
Participant
1182 Points
1697 Posts
Re: How to move value from one form to another
May 27, 2009 06:48 PM|LINK
I did this way...
protected void btnOrg_Click1(object sender, EventArgs e)
{
Session["name"] = txtFName.Text;
}
btnOrg.OnClientClick = "window.open('Organization.aspx','mywindow','width=700,height=600')";
and on Page_Load()
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string value = Server.UrlDecode(Request.QueryString["value"]);
string ids = Server.UrlDecode(Request.QueryString["id"]);
if (ids != null || value != null)
{
txtOrgnization.Text = ids.ToString();
lblOrgId.Text = value.ToString();
txtFName.Text = Session["name"].ToString();
}
else
{
}
It works..!! But I want to know Is this proper...? means trustable method..?
And if I have many controls..So i have to declare all session variables to each control...Or i should use datatable...?
thanx
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: How to move value from one form to another
May 27, 2009 07:21 PM|LINK
Session is the most secure one
You can declare an array and store all the data in that array and finally array in session
session can store all objects
ArrayList arr = new ArraList();
Session["name"] =arr;
ArrayList arr = (ArrayList)Session["name"];
Contact me
demoninside9
Participant
1182 Points
1697 Posts
Re: How to move value from one form to another
May 28, 2009 03:07 AM|LINK
Thanx
Suppose I am having 2 TextBoxes(TextBox1, TextBox2) and a DropDownList(DropDownList1).
So can you please, show that how to store these values in an array and this array in session.
as you know I am very new.
Thanx you sir[:)]