Template with asp.net

  • Thread starter Thread starter Stan Sainte-Rose
  • Start date Start date
S

Stan Sainte-Rose

Hi,

I m looking for a good example with asp.net (the best will be a vb.net code)
for how to make and use a web template.
With ASP, I used "include", and I know it's impossible with asp.net



Thanks for your precious help.

Stan
 
Hi Stan,

In ASP.NET, you would typically use a User Control for that type of
functionality.

Jim Cheshire, MCSE, MCSD [MSFT]
ASP.NET
Developer Support
(e-mail address removed)

This post is provided "AS-IS" with no warranties and confers no rights.

--------------------
 
Hi guys,

I thank you for your replies..
I read the last sample from George, and I have a couple of questions..

It seems with asp.net, you could not have a kind of "autonomous" control..
I hear by autonomous, have control user with its own actions..
Example :
I have a section part into my layout that allows the user to log in.
So I have the bit of code with asp

<Form action="login.asp">
<Input type="text" name="userid">
<Input type="text" name="password">
<Input type="submit" value="login" name="login">
</form>

Another part where the user can search..

<Form action="search.asp">
<Input type="text" name="keywords">
<Input type="submit" value="Search" name="Search">
</form>

All these parts are duplicated into my several pages (as I said using
Include).
When I read the code from the masterpages concept, I ve seen that I have to
paste the different actions
for the Click events into the different pages that use the user controls,
isn't it ?
I m talking about this bit of code :
<script runat="server">
void ClickedCapitalize(object o, EventArgs e) {
capitalized.Text = Server.HtmlEncode(tb1.Text.ToUpper());
}

void SayHello(object o, EventArgs e) {
name.Text = Server.HtmlEncode(tb2.Text);
}
</script>

Is it the only way to accomplish this ?

Regards
Stan
 
Actually it's opposite.
Practically any control in ASP.NET is "autonomous".
Try to rewrite the login control.

Also you can always use Usercontrols the same way as you use "include" in
asp. With more features like adding dynamic properties to it.

George.
 
Back
Top