Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Passing property values from popup to Main Webform?

Reply
Thread Tools

Passing property values from popup to Main Webform?

 
 
=?Utf-8?B?Vk1J?=
Guest
Posts: n/a
 
      10-11-2006
How can I pass variable or Property values from my popup webForm to the
webform that opened this popup?
For information that's in a control (i.e. Textbox), I'm using javascript and
document.getElementById:

var variable = document.getElementById('txtBox).value;

But if the control is hidden, that javascript code generates an error. Can
this be done with properties?
Thanks.


 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      10-11-2006
"VMI" <> wrote in message
news8886D49-8266-4588-A781-...

> How can I pass variable or Property values from my popup webForm to the
> webform that opened this popup?


http://msdn.microsoft.com/library/de...odaldialog.asp

> For information that's in a control (i.e. Textbox), I'm using javascript
> and
> document.getElementById:
>
> var variable = document.getElementById('txtBox).value;


I'm assuming that the missing apostrophe after txtBox is just a typo...?

> But if the control is hidden, that javascript code generates an error.


Sigh - WHAT ERROR DOES IT GENERATE?

> Can this be done with properties?


Yes.


 
Reply With Quote
 
 
 
 
bruce barker \(sqlwork.com\)
Guest
Posts: n/a
 
      10-11-2006
there is hidden (type=hidden) and invisible. javascript can see hidden
fields. fields marked invisible are not render, so the brwser does not see
them.

-- bruce (sqlwork.com)

"VMI" <> wrote in message
news8886D49-8266-4588-A781-...
> How can I pass variable or Property values from my popup webForm to the
> webform that opened this popup?
> For information that's in a control (i.e. Textbox), I'm using javascript
> and
> document.getElementById:
>
> var variable = document.getElementById('txtBox).value;
>
> But if the control is hidden, that javascript code generates an error. Can
> this be done with properties?
> Thanks.
>
>



 
Reply With Quote
 
=?Utf-8?B?Vk1J?=
Guest
Posts: n/a
 
      10-11-2006
Thanks for the post. Sorry about the vague post.
The missing apostrophe was just a typo when I posted the message.
The error I get when I try to get the server-side textBox value (when
visible= false) is "Object Requred". If I make it visible, it works. The
problem is that this information doesn't need to be displayed.
I'm using server-side textboxes because they interact with a gridview and I
feel more comfortable with them. So I can't use (Type= hidden).
How can this be done with properties instead of retrieving the value of the
Textbox?
Thanks.

"Mark Rae" wrote:

> "VMI" <> wrote in message
> news8886D49-8266-4588-A781-...
>
> > How can I pass variable or Property values from my popup webForm to the
> > webform that opened this popup?

>
> http://msdn.microsoft.com/library/de...odaldialog.asp
>
> > For information that's in a control (i.e. Textbox), I'm using javascript
> > and
> > document.getElementById:
> >
> > var variable = document.getElementById('txtBox).value;

>
> I'm assuming that the missing apostrophe after txtBox is just a typo...?
>
> > But if the control is hidden, that javascript code generates an error.

>
> Sigh - WHAT ERROR DOES IT GENERATE?
>
> > Can this be done with properties?

>
> Yes.
>
>
>

 
Reply With Quote
 
Gozirra
Guest
Posts: n/a
 
      10-11-2006
Try this.

<asp:TextBox style="display:none" runat="server"
ID="txtTest"></asp:TextBox>

It will still render and your javascript will work as expected.

 
Reply With Quote
 
GroupReader
Guest
Posts: n/a
 
      10-11-2006
Yes, I agree with Gozirra.

Some more information: for server-side textboxes, if you set the
Visible property = false, then asp.net tries to be "smart" and does not
render the text box at all. This is not what you want and is
completely different from rendering a textbox that is not visible.

Three common ways to solve your issue:
1) CSS Solution: Like Gozirra said, use the display:none style
2) Asp.Net 1.1 Solution: In the code-behind, use
"Attributes.Add(visible, false)". This will set the html visible
property to false, not the ASP.Net Visible property.
3) Asp.Net 2.0 Solution: Asp.net 2.0 has a new control to solve this
issue called: <asp:hiddenfield>. This is probably the preferred way
to do it in asp.net 2.0. Microsoft created the hiddenfield control to
solve the problem you are having. Use a HiddenField control instead of
a TextBox.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Databindings property - I want to disable true values rather than false values Steve ASP .Net 4 01-27-2006 01:02 PM
adding main.aspx.vb & main.aspx.resx under aspx John M ASP .Net 1 05-29-2005 09:27 PM
Popup - passing values with a JS confirm aaa ASP .Net 0 05-20-2005 09:28 PM
Main > Popup > Popup > Close popup AND new URL in main? Jens Peter Hansen Javascript 7 06-19-2004 08:56 PM



Advertisments