Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ascx

Status
Not open for further replies.

g2000

Programmer
Aug 31, 2005
39
US
Can I put a variable to this tag?
For instance, I have
<script runat=server>
String notVar = "12345";
</script>

<myTagPrefix:myTagName id="myId" myVar=notVar runat=server>

The above notVar is a variable, by my defintion. But the output shows as if it is a text. It shows as notVar instead of 12345.

 
You still need an action event to load the variable in a user control. Use a Page_Load to set that.
Code:
void page_load
 If not page.ispostback
 {
    String notVar = "12345";
 }
}
 
oops...

declare notvar outside of that for a page variable

if not postback
notVar = "12345";
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top