Object/Control state

S

seth

The Environment:
I have a 3rd party control referenced as an object on an aspx page with
inline code in script tags accessing the methods of properties of same. I
also have a Codebehind page handling all the non-object chores.

The Problem:
The object/control has as one of its properties 'FileName' which is a
string. I need to pass the value of that property to some container so that
my Codebehind page will have access to the value of that string.

Failed Solutions:
1)From within the inline sub I can change the .innerText of a div or span
but the Codebehind page doesn't "see" the container.
2)From within the inline sub an asp:label doesn't expose the normal .text
3)From within the inline sub trying to set a Session() variable errors out
saying 'type mismatch: Session' ... I've already checked IIS to make sure
saving Session variables is OKd

Any suggestions?
thx in advance,
S~
 
F

Fergus Cooney

Hi Seth,

If I understand correctly, the 3rd-party Control is client-side but you
want the server-side Code Behind to access one of the properties.

Have you tried using a hidden TextBox or other runat=server Control?

Or use a plain Html TextBox - not a WebForms Control. Then do a submit.

Or have the (plain) TextBox's onchange transfer the contents into a
WebForms TextBox which will submit itself.

Or have your inline code create the url = "http://blah.com?FileName=<file
name here>"

Regards,
Fergus
 
C

Cor

Hi Seth,
I did make something, I don't say it is nice but I thinks it works, when you
have a better solution some day, will you post it than here.
\\\

ASPX.VB part
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.Button1.Attributes("onclick") = "javascript:settext(0);"
End Sub

Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim a As String = Me.TextBox1.Text
End Sub

ASPX html part
(some code around the body tag.)
<script type="text/javascript">
function settext(a){
if (a==1){document.all.item("textbox1").style.visibility="hidden"}
else {document.all.item("textbox1").innerText="some text";}}
</script>
</HEAD>
<body onload="settext(1);" MS_POSITIONING="GridLayout">
..........
////
It uses the input from the textbox to transfer data from the page to you.
I hope it helps you
Cor
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top