Friday, March 16, 2012

parameters

Hello,

now I am trying to pass a string as a parameter to a control:

<% Dim strString = "Hello" %>
Text: <input type="TEXT" name="T2" value="<%=strString%>" size="60"
Here the output is: "Hello",
but when I try it with a control that runs on the server it doesn't work
(runat=server):

<% Dim strString = "Hello" %>
Text: <input type="TEXT" name="T2" value="<%=strString%>" size="60"
runat=server
Here the output is: "<%=strString%>"

I've tried to put the complete statement into a "Response.Write()" but that
doesn't do the trick either.

Is there a way to give a string as paramter to a control that runs on the
server?

Thanks.runat="server" creates an instance of an object server-side which provides a
very righ programming model. Your solution is how you'd do things in
classic-asp, but not in asp.net

<input type="TEXT" name="T2" id="someId" size="60"
runat=server
<script language="vb" runat="Server">
sub Page_Load
someId.Text = "Hello"
end sub
</script
or something similar using the codebehind model.

Cheers,
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Qwert" <nosp@.nosp.com> wrote in message
news:AfqdnSV1jJK2-x7fRVnyiw@.casema.nl...
> Hello,
> now I am trying to pass a string as a parameter to a control:
> <% Dim strString = "Hello" %>
> Text: <input type="TEXT" name="T2" value="<%=strString%>" size="60" >
> Here the output is: "Hello",
> but when I try it with a control that runs on the server it doesn't work
> (runat=server):
> <% Dim strString = "Hello" %>
> Text: <input type="TEXT" name="T2" value="<%=strString%>" size="60"
> runat=server >
> Here the output is: "<%=strString%>"
> I've tried to put the complete statement into a "Response.Write()" but
> that doesn't do the trick either.
> Is there a way to give a string as paramter to a control that runs on the
> server?
> Thanks.
Thank you, it works, woot. The code even looks nicer. How about that.

> runat="server" creates an instance of an object server-side which provides
> a very righ programming model. Your solution is how you'd do things in
> classic-asp, but not in asp.net
>
> <input type="TEXT" name="T2" id="someId" size="60"
> runat=server >
> <script language="vb" runat="Server">
> sub Page_Load
> someId.Text = "Hello"
> end sub
> </script>
> or something similar using the codebehind model.
> Cheers,
> Karl
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/ - New and Improved (yes, the popup is
> annoying)
> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
> come!)
> "Qwert" <nosp@.nosp.com> wrote in message
> news:AfqdnSV1jJK2-x7fRVnyiw@.casema.nl...
>> Hello,
>>
>> now I am trying to pass a string as a parameter to a control:
>>
>> <% Dim strString = "Hello" %>
>> Text: <input type="TEXT" name="T2" value="<%=strString%>" size="60" >
>>
>> Here the output is: "Hello",
>> but when I try it with a control that runs on the server it doesn't work
>> (runat=server):
>>
>> <% Dim strString = "Hello" %>
>> Text: <input type="TEXT" name="T2" value="<%=strString%>" size="60"
>> runat=server >
>>
>> Here the output is: "<%=strString%>"
>>
>> I've tried to put the complete statement into a "Response.Write()" but
>> that doesn't do the trick either.
>>
>> Is there a way to give a string as paramter to a control that runs on the
>> server?
>>
>> Thanks.
>>

0 comments:

Post a Comment