Passing property values from popup to Main Webform?

Discussion in 'ASP .Net' started by =?Utf-8?B?Vk1J?=, Oct 11, 2006.

  1. 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.
    =?Utf-8?B?Vk1J?=, Oct 11, 2006
    #1
    1. Advertising

  2. =?Utf-8?B?Vk1J?=

    Mark Rae Guest

    "VMI" <> wrote in message
    news:D...

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


    http://msdn.microsoft.com/library/d...r/dhtml/reference/methods/showmodaldialog.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.
    Mark Rae, Oct 11, 2006
    #2
    1. Advertising

  3. 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
    news:D...
    > 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.
    >
    >
    bruce barker \(sqlwork.com\), Oct 11, 2006
    #3
  4. 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
    > news:D...
    >
    > > How can I pass variable or Property values from my popup webForm to the
    > > webform that opened this popup?

    >
    > http://msdn.microsoft.com/library/d...r/dhtml/reference/methods/showmodaldialog.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.
    >
    >
    >
    =?Utf-8?B?Vk1J?=, Oct 11, 2006
    #4
  5. =?Utf-8?B?Vk1J?=

    Gozirra Guest

    Try this.

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

    It will still render and your javascript will work as expected.
    Gozirra, Oct 11, 2006
    #5
  6. =?Utf-8?B?Vk1J?=

    GroupReader Guest

    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.
    GroupReader, Oct 11, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. titof
    Replies:
    0
    Views:
    486
    titof
    Jul 24, 2003
  2. timmso
    Replies:
    1
    Views:
    466
    Alex Papadimoulis
    Dec 12, 2003
  3. =?Utf-8?B?bXN1aw==?=

    Using one webform to set a value on another webform

    =?Utf-8?B?bXN1aw==?=, Jul 12, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    440
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Jul 12, 2006
  4. =?Utf-8?B?Vk1J?=

    Moving value from popup Webform to main Webform?

    =?Utf-8?B?Vk1J?=, Oct 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    555
    GroupReader
    Oct 9, 2006
  5. Jens Peter Hansen
    Replies:
    7
    Views:
    499
    Randy Webb
    Jun 19, 2004
Loading...

Share This Page