List Info

Thread: Help getting label value set by javascript




Help getting label value set by javascript
country flaguser name
United States
2007-10-19 14:30:32

Hey all -

I have a value being set to a asp:label from a javascript call in an asp.net pop-up page:

Page.RegisterClientScriptBlock("ReloadParent&quot;, "<script language='javascript'>window.opener.lblImage.innerText='&quot; & strValue & "'<;" & "/script>&quot;)

The user clicks a button, opens a new window, inputs a value and that value gets passed back to the parent window and the child (or pop-up) close. This works fine.

My problem is that I can't seem to retrieve it when it submit the page.

My thought is that this has to do with the way I'm setting the value and/or the post back but I'm not sure how to work around this.

Any ideas?

Thanks,
Mark

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
Re: Help getting label value set by javascript
country flaguser name
United States
2007-10-19 14:47:18

becuause you need a viewstate for that control !!!
when we add a value by using javascript and then you do a post back the last added value will disappear becuase when we are doing a post back the server cotrol will read his value from his viewstate property .
so I suggest to add hiddenfield by adding the value from popup page to two controls : one for the label and the same value add it to the hidden field . and then after any post back read the value of the hidden field in page load and put it in the lable ..

i hope its help



Mark E < meckeard2000%40yahoo.com">meckeard2000yahoo.com> wrote:
Hey all -

I have a value being set to a asp:label from a javascript call in an asp.net pop-up page:

Page.RegisterClientScriptBlock("ReloadParent&quot;, "<script language='javascript'>window.opener.lblImage.innerText='&quot; & strValue & "'<;" & "/script>&quot;)

The user clicks a button, opens a new window, inputs a value and that value gets passed back to the parent window and the child (or pop-up) close. This works fine.

My problem is that I can't seem to retrieve it when it submit the page.

My thought is that this has to do with the way I'm setting the value and/or the post back but I'm not sure how to work around this.

Any ideas?

Thanks,
Mark

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

[Non-text portions of this message have been removed]

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
Re: Help getting label value set by javascript
country flaguser name
United States
2007-10-19 14:47:56

Hi Mark,

Labels don't send any information to the server on a postback. For that,
you need a form field (a textbox, hidden or visible, would do the job).

Cheers,

Peter

On 10/19/07, Mark E < meckeard2000%40yahoo.com">meckeard2000yahoo.com> wrote:
&gt;
> Hey all -
>
> I have a value being set to a asp:label from a javascript call in an
> asp.net pop-up page:
&gt;
> Page.RegisterClientScriptBlock("ReloadParent&quot;, "<script
&gt; language='javascript'>window.opener.lblImage.innerText='&quot; & strValue &
&gt; "'<;" & "/script>&quot;)
>
> The user clicks a button, opens a new window, inputs a value and that
>; value gets passed back to the parent window and the child (or pop-up) close.
&gt; This works fine.
&gt;
> My problem is that I can't seem to retrieve it when it submit the page.
&gt;
> My thought is that this has to do with the way I'm setting the value
&gt; and/or the post back but I'm not sure how to work around this.
&gt;
> Any ideas?
&gt;
> Thanks,
> Mark
>;

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )