How to set the value to the hidden control in the child page from the client-side of the parent page

Hi All,

    I need to set the value in the hidden input control (which i have used in the child page) from the parent page. I don't want to use session, since i want to set it from the client-side of the parent page and i have to access the value in the server-side of the child page. I tried using javascript but the value didnt get set. I'm in need of a solution urgently.

Thanks & Regards

Aishwaria

0
AishwariaS
3/19/2007 11:43:56 AM
asp.net.web-forms 93655 articles. 6 followers. Follow

5 Replies
1613 Views

Similar Articles

[PageSpeed] 57

hello my friend,

My suggestion is using querystring to send the value to the child page

code sample

parent page

   <input id="Button1" type="button" value="button" onclick="window.open('Child.aspx?value=123')"/>

child page

 protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["value"] != "")
        {
            HiddenField1.Value = Request.QueryString["value"];
        }
    }

hope it helps,

Jessica

 


Jessica Cao
Sincerely,
Microsoft Online Community Support


“Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
0
Jessica
3/20/2007 3:43:59 AM

I have the child page inside the frame and on click of the button in the parent page, i have submitted the page,

frameUpdater.document.forms[0].submit();

So that the page load method in the child page is called, and, based on the hiddenfield value certain operations are done in the page load. I just can't use window.open at this scenario, since i'm submitting the page which is already opened. So i need a way to set the hidden field value b4 the page is submitted.

0
AishwariaS
3/20/2007 4:39:03 AM

I have the child page inside the frame and on click of the button in the parent page, i have submitted the page,

frameUpdater.document.forms[0].submit();

So that the page load method in the child page is called, and, based on the hiddenfield value certain operations are done in the page load. I just can't use window.open at this scenario, since i'm submitting the page which is already opened. i need a way to set the hidden field value before the page is submitted.

0
AishwariaS
3/20/2007 4:39:31 AM

I'm not sure if I understand your problem, but I'll give it a shot.

In my application, my frame is called "flashdisplay" and I needed to pass a value to the page..so i did in javascript

if (window.frames.flashdisplay && window.frames.flashdisplay.doPassVar) {
                    window.frames.flashdisplay.doPassVar(flashindex);
                    flashindex++;
                }
                else{
                    //alert("flash object null");
                }

where doPassVar is a javascript function inside the chidl page.

Child page
------------------------

 function doPassVar(args){
    var sendText = args.value;
   //do whatever with my value
}

so you might want to mess around your javascript a little bit before your parent page is submitted. good luck


Liming Xu
Jumptree ASP.NET 2.0 Project Management - With Source Code, Free to Non Profit Org and Effectively Manage Projects/Tasks/Milestones
0
Liming
3/20/2007 5:06:10 AM

I've got one other problem. I've a requirement, suppose there are 3 pages(A, B & C) for which the design is exactly same as the other. In this scenario i have reused a single page for all the three. And as i told earlier i have places these three pages inside a frame. On click of the button i'd determine which page should be loaded in the frame with the change of appropriate display names and values. After the page is submitted from the parent page, in the client side of the child page i have used a javascript which initializes the page to be loaded in the frame. Though the frame source is assigned, the page load method in the child page doesn't get called and the previously loaded page gets called. For example, when we move from A-> B, on click of the button in B, it doesnt go C, it goes to A and on click of the button the next time it moves to C.

The code which i've used, 

Client side - child page

if(document.DatabaseInfo.hdnNavigatePage.value != "" && window.top.appMain != null)

{ window.top.appMain.ChangeFrame(document.DatabaseInfo.hdnNavigatePage.value); }

Java script

this.ChangeFrame = function(source)

{

if(source != "")

this.frameElements.src = source; 

}
 

Client side - child page

if(document.DatabaseInfo.hdnNavigatePage.value != "" && window.top.appMain != null)

{ window.top.appMain.ChangeFrame(document.DatabaseInfo.hdnNavigatePage.value); }

Java script

this

.ChangeFrame = function(source)

{

if(source != "")

this.frameElements.src = source;

}

0
AishwariaS
3/20/2007 6:02:47 AM
Reply:

Similar Artilces:

Pass value from Child page to Parent page ( to locate sub controls of parent page )
Team, This is a question related parent and child webform or webpage. My utlimate aim is to pass or update a control of my parent page from child page. The Design   Parent Page --------------   Parent DataList 1       Child DataList 1          Textbox1 Textbox2 Textbox3 Textbox4       Child Datalist 2          Textbox1 Textbox2 Textbox3 Textbox4       Child Datalist 3     ...

The value set to controls at client side donot persist for each page load, else it is again set to the default value...??
 I am trying to set date to the textbox field using javascript (Client side), the function is as follows. function From_calendarPicker(){                                var    sDPath = "../Calender.aspx";                 var    oWin = window.showModalDialog(sDPath, null, "dialogWidth:300px;dialogHeight:250px;help:0;status:0;scroll:0;center:1");  &nbs...

Updating "Parent" Web Page with Value from Pop-up "Child" Web Page
Hi, all. I'm having a problem updating a cell in a table row on my parent web page with the updated value from my child web page. I am using a script to pass the value back to the parent page (script is executed in child web page button exit event handler). If I put the updated value in a textbox on the parent page, it works fine. However, when I attempt to put the updated value in the table row cell I get an error: table row is not an object or the object is null. NOTE: I am doing this without a postback on the parent page. I tried creating all the rows dynamically in the code beh...

parent web page --child web page
Dear Developers , how to get values child web page values to parent web page ? For the example , I have parent Employee Address. and child Page have employee personal address.. when i access the Parent page , there is no employee address means ..child page pop rises , after complete child page then only , i can access the parent page.. how to i do .. Thanking u raja Thanks,Regards,Rajamsrasa@yahoo.com...

Accessing the parent page from the child page that is in iframe of parent page
Is is possible to get a reference to the controls of the parent.aspx page from child.aspx page, which is actually referenced from the parent page through iframe tag. I have an ParentPage.aspx with an Iframe in it. I set a child page ChildPage.aspx to the Iframe programatically using Attributes("Src")  from the ParentPage.aspx.  Now, is there a way for me to get hold of the controls of parent page from the child page. If I do something like this in child.aspx.cs class Parent. It shows that parent is empty. Please help... thanks -SarahSarah Cameron Benjamin H...

How can i create get values from Opened page in client side to my first page(server page)
i have a little bit problem that my Server page has coding like this : btn.attributes.add("onclick()",getdata()) and one text box is txt1 now when user clicks it Button btn then getdata function  executes ok client page function getdata(){ response.redirect("hello.aspx") } now on hello.aspx has 1 textbox txt2   now what ever the data has been inputted by user in (client side textbox) txt2 i want to assign it to txt1 (server side )conrtol on server pls help me send me code ...  Jay "Enjoy Life" When you do the redirect from Page #2 back to Page...

A page can have only one server-side Form tag
I have a web user control in my web page.  The user control (ascx) consist of a text box and button. The web page consist of text boxes and buttons also.  Both pages have form tags with runat=server.  When I run the web page it comes up with the error "A page can have only one server-side Form tag." Both the user control and web page need the form tag with runat=server.  Is there a way I can code these pages where there won't be a conflict between the web user control and the web page? Thanks   JohnMo wrote:Both the user control and web page need the form tag wit...

Finding controls on parent page from child page
Is there a way to find a control on a parent page from a child page?  On my page 'A', I have a link to open a new page 'B'.  From page 'B', I am trying to locate a dropdownlist on page 'A'.   Here is the code I tried so far:           Dim ddTrainingTopic As New DropDownList                    'ddTrainingTopic = Me.Master.FindControl("ContentPlaceHolder1").FindControl("ddTrainingTopicL...

how to pass value from parent page to child page
Hi, I want to pass string value from Parent page to Child page.  How can I do this.  I am using asp.net 2.0 and C#.  Please give me a solution.  Thanks in advance.....  regards, MaxiMaxi Hi, the easiest way to do this, is to pass the value via QueryString, like this: childPage.aspx?stringValue=data Or you can use a Session variable like this: Session["StringValue"]. Set the value in the parent page and read the value from the Session variable in the child page. RegardsMarc André hi, thanks for your suggestion, but I dont want to use Session or Query ...

pass value child page to parent page
hi, im using checkbox list  on child page.it was displaying from database,i want to pass the checkbox value to parent page label control and if i un check the check box  that value is remove. this is my concept.i need the code,if anyone knows pls send the code.   Hi,What you can do is you can call a JavaScript Parent function from child window and can pass the value that you want..For ExampleFunction in Parent function setValue(strvalue){  var lbl = document.getElementByID('Label').innerHTML = strValue;}This is how you will call the function from Child ...

Can my web page with a form submit to other web pages forms?
I was wondering if I created an aspx page that had a form on it that I could use the submit button to submit this form's contents to other web pages forms(servers accepting those form's data). I am thinking this would be a great way to update data on particular web pages without having to actually visit those similar web pages. Any ideas, examples would be much appreciated. Thanks in advance.  Yes you can.  It's called Cross Page Posting: http://msdn2.microsoft.com/en-us/library/ms178139.aspxAlso: http://msdn2.microsoft.com/en-us/library/ms178140.aspx might ...

with a theme set in a child page, setting attributes of a control in the master page don't work
I have noticed that if I dont't use a theme in a child page, the attributes such as bold, font-size, color of a control flow through from the Master Page. For example, if I have a label in a master page that has attributes set, it will show correctly when linking with the child pages if I don't have a theme for the child page, if I do have a them set, it shows standard black text with a default font.  Any help would be very much appreicated.  well, in your theme you might be overwrinting styles, more specially, the stylesheet. And if you're using skind, same is...

textbox value set on client side, is not visible on server side or, on the source of the page.
hi, I have a textbox on my webform. the first time I load my page I fill this textbox with  "name" on the server side. once the page is loaded I set the value of the textbox to "thisIsme" with client side code. I even see a different text in the texbox. client side:document.all('txtnameInput').value =  'thisIsme'; server side:Me.txtnaam.Text 'is stil "name" and not "thisIsme" Why is this happening? on the webpage I see the text "thisIsme", but when I look at the source of the webpage I still see the old value in it. it's very odd... I am NOT setting the value back to "name...

Value of the control at Master page is not being set from the content page
I am trying to set the value of the control at Master Page from the child page(content page) but the value of the control at master page is not changing.."Hope its your Solution so Mark it as Answer"Ahmad SheikhMicrosoft Valuable Geekhttp://sharpcontents.blogspot.com Here is a good tutorial on doing this from scott. http://www.odetocode.com/Articles/450.aspx here is the part you are looking for I think. Protected Sub Page_Load(ByVal sender As Object, _                     &...

Web resources about - How to set the value to the hidden control in the child page from the client-side of the parent page - asp.net.web-forms

Client-side - Wikipedia, the free encyclopedia
Client-side refers to operations that are performed by the client in a client–server relationship in a computer network . Typically, a client ...

Senior Search Manager - Client Side!!
... strategy insight for senior IT management - resources to understand and leverage information technology. Senior Search Manager - Client Side ...

Account Manager - Client Side - Previous Agency Experience Welcome!!
Computerworld Australia is the leading source of technology news, analysis and tools for IT decision makers, managers and professionals.

Media Sales Executive - Client Side!!
Technology news and reviews for business and home.

PPC Paid Search Manager - CLIENT SIDE
Defining Technology for Australia's IT Leaders. PPC Paid Search Manager - SEM - **CLIENT SIDE** Sydney CBD Location Client side!! SEM/PPC/Paid ...

How Basecamp Next got to be so damn fast without using much client-side UI
When we started working on Basecamp Next last year, we had much internal debate about whether we should evolve the existing code base or rewrite ...

Seven Tips for Pitching From the Client's Side of the Table
I had a chance to sit on the other side of the pitch table. Here is what I learned.

Client-side coding: How to prevent malicious use?
Applications that run on a user-controlled device cannot be perfectly protected.

The client side
... regarding the professionals you seek to assist. Even better if you possess that understanding yourself, having worked on the client side. I'm ...

Ecommerce traffic being hijacked by client side malware
According to new research 15 to 30 percent of eCommerce site visitors are infected with Client Side Injected Malware (CSIM) that causes them ...

Resources last updated: 1/12/2016 3:13:46 PM