Thursday, March 29, 2012
Newbie: How to duplicate a webform (including code) - I'm confused.
I am sure there is a very simple answer to this question. But how does one
duplicate a webform in ASP.net? E.g. I have a webform that has standard
basic functionality for my whole web application (e.g. a navigation bar and
general layout). I want to copy this form many times as it is the template
for each page within my application.
However, when I use "save as" and save the webform as a different name,
things do not go as planned. Also I want all the underlying code to be
copied as well (e.g. so if I use a link button, on my first page, I want the
underlying code for that button to also copy through to the duplicate page).
So how is this achieved?
I'm probably going to be told there is a better way of having a template
page as well. This information will be useful as well, but for the time
being, duplicating manually a template page will do fine.
Kind regards
Dave.Dave, in ASP.NET 1.x, there's not a real easy way to do this. There are
Master Pages - http://aspnet.4guysfromrolla.com/articles/040704-1.aspx -
but these have poor tool support in VS.NET 2002/2003.
Fortunately this becomes much less of a pain with ASP.NET 2.0 and Visual
Studio 2005... but for the time being, it's not as easy as it *should*
be. But do check out Master Pages in ASP.NET 1.x, it's better than just
copying and pasting code around on each page...
Dave Smithz wrote:
> I am sure there is a very simple answer to this question. But how does one
> duplicate a webform in ASP.net? E.g. I have a webform that has standard
> basic functionality for my whole web application (e.g. a navigation bar an
d
> general layout). I want to copy this form many times as it is the template
> for each page within my application.
> However, when I use "save as" and save the webform as a different name,
> things do not go as planned. Also I want all the underlying code to be
> copied as well (e.g. so if I use a link button, on my first page, I want t
he
> underlying code for that button to also copy through to the duplicate page
).
> So how is this achieved?
> I'm probably going to be told there is a better way of having a template
> page as well. This information will be useful as well, but for the time
> being, duplicating manually a template page will do fine.
Scott Mitchell
mitchell@.4guysfromrolla.com
http://www.4GuysFromRolla.com
* When you think ASP.NET, think 4GuysFromRolla.com!
"Scott Mitchell [MVP]" <mitchell@.4guysfromrolla.com> wrote in message
news:h6Dfd.10379> Dave, in ASP.NET 1.x, there's not a real easy way to do
this. There are
> Master Pages - http://aspnet.4guysfromrolla.com/articles/040704-1.aspx -
> but these have poor tool support in VS.NET 2002/2003.
OK So not such a stupid question then. But now I probably have one. I've
knocked together a basic ASP.net website to show someone. But I wnat to show
them without having to run Visual Studio.net. Currently I press f5 to run
the web application, but I want to be able to just go to a URL without
having to run VS first.
How do I do this?
Kind regards
Dave
"Dave Smithz" <SPAM FREE WORLD> wrote in message
news:417fb0f2$1@.news1.homechoice.co.uk...
> "Scott Mitchell [MVP]" <mitchell@.4guysfromrolla.com> wrote in message
> news:h6Dfd.10379> Dave, in ASP.NET 1.x, there's not a real easy way to do
> this. There are
> OK So not such a stupid question then. But now I probably have one. I've
> knocked together a basic ASP.net website to show someone. But I wnat to
> show
> them without having to run Visual Studio.net. Currently I press f5 to run
> the web application, but I want to be able to just go to a URL without
> having to run VS first.
> How do I do this?
What happens if you just go to the URL?
--
John Saunders
"John Saunders" <johnwsaundersiii@.hotmail.com> wrote in message >
> What happens if you just go to the URL?
> --
> John Saunders
errrr, it seems to work now. But I tell you it didn't before! ;)
Cheers
Newbie: How to duplicate a webform (including code) - Im confused.
I am sure there is a very simple answer to this question. But how does one
duplicate a webform in ASP.net? E.g. I have a webform that has standard
basic functionality for my whole web application (e.g. a navigation bar and
general layout). I want to copy this form many times as it is the template
for each page within my application.
However, when I use "save as" and save the webform as a different name,
things do not go as planned. Also I want all the underlying code to be
copied as well (e.g. so if I use a link button, on my first page, I want the
underlying code for that button to also copy through to the duplicate page).
So how is this achieved?
I'm probably going to be told there is a better way of having a template
page as well. This information will be useful as well, but for the time
being, duplicating manually a template page will do fine.
Kind regards
Dave.Dave, in ASP.NET 1.x, there's not a real easy way to do this. There are
Master Pages - http://aspnet.4guysfromrolla.com/articles/040704-1.aspx -
but these have poor tool support in VS.NET 2002/2003.
Fortunately this becomes much less of a pain with ASP.NET 2.0 and Visual
Studio 2005... but for the time being, it's not as easy as it *should*
be. But do check out Master Pages in ASP.NET 1.x, it's better than just
copying and pasting code around on each page...
Dave Smithz wrote:
> I am sure there is a very simple answer to this question. But how does one
> duplicate a webform in ASP.net? E.g. I have a webform that has standard
> basic functionality for my whole web application (e.g. a navigation bar and
> general layout). I want to copy this form many times as it is the template
> for each page within my application.
> However, when I use "save as" and save the webform as a different name,
> things do not go as planned. Also I want all the underlying code to be
> copied as well (e.g. so if I use a link button, on my first page, I want the
> underlying code for that button to also copy through to the duplicate page).
> So how is this achieved?
> I'm probably going to be told there is a better way of having a template
> page as well. This information will be useful as well, but for the time
> being, duplicating manually a template page will do fine.
--
Scott Mitchell
mitchell@.4guysfromrolla.com
http://www.4GuysFromRolla.com
* When you think ASP.NET, think 4GuysFromRolla.com!
"Scott Mitchell [MVP]" <mitchell@.4guysfromrolla.com> wrote in message
news:h6Dfd.10379> Dave, in ASP.NET 1.x, there's not a real easy way to do
this. There are
> Master Pages - http://aspnet.4guysfromrolla.com/articles/040704-1.aspx -
> but these have poor tool support in VS.NET 2002/2003.
OK So not such a stupid question then. But now I probably have one. I've
knocked together a basic ASP.net website to show someone. But I wnat to show
them without having to run Visual Studio.net. Currently I press f5 to run
the web application, but I want to be able to just go to a URL without
having to run VS first.
How do I do this?
Kind regards
Dave
"John Saunders" <johnwsaundersiii@.hotmail.com> wrote in message >
> What happens if you just go to the URL?
> --
> John Saunders
errrr, it seems to work now. But I tell you it didn't before! ;)
Cheers
"Dave Smithz" <SPAM FREE WORLD> wrote in message
news:417fb0f2$1@.news1.homechoice.co.uk...
> "Scott Mitchell [MVP]" <mitchell@.4guysfromrolla.com> wrote in message
> news:h6Dfd.10379> Dave, in ASP.NET 1.x, there's not a real easy way to do
> this. There are
>> Master Pages - http://aspnet.4guysfromrolla.com/articles/040704-1.aspx -
>> but these have poor tool support in VS.NET 2002/2003.
> OK So not such a stupid question then. But now I probably have one. I've
> knocked together a basic ASP.net website to show someone. But I wnat to
> show
> them without having to run Visual Studio.net. Currently I press f5 to run
> the web application, but I want to be able to just go to a URL without
> having to run VS first.
> How do I do this?
What happens if you just go to the URL?
--
John Saunders
Newbie: how to handle large response.write blocks
Is there a way to abbreviate the aspx below? Specifically, is there a
way to eliminate the response.write syntax and escaped characters?
<%
if (MyObject.SomeBoolean)
{
Response.Write("<div class=\"myclass\">");
Response.Write("You may have won 1,000,000 dollars...");
Response.Write("lots of text...");
Response.Write("lots of text...");
Response.Write("</div>");
}
else
{
Response.Write("<div class=\"error\">");
Response.Write("You should buy more magazines...");
Response.Write("lots of text...");
Response.Write("lots of text...");
Response.Write("</div>");
}
%>
Thanks.
BrianIn C#, Not. If you want to have a literal quote in a string you have to plac
e
the \ escape before it.
Regarding not having to type Response.Write so much, try stuffing all your
strings into a StringBuilder instance. At the end, you can write one time:
Response.Write(myStringBuilder.ToString());
Peter
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"Brian F" wrote:
> Hi everyone -
> Is there a way to abbreviate the aspx below? Specifically, is there a
> way to eliminate the response.write syntax and escaped characters?
> <%
> if (MyObject.SomeBoolean)
> {
> Response.Write("<div class=\"myclass\">");
> Response.Write("You may have won 1,000,000 dollars...");
> Response.Write("lots of text...");
> Response.Write("lots of text...");
> Response.Write("</div>");
> }
> else
> {
> Response.Write("<div class=\"error\">");
> Response.Write("You should buy more magazines...");
> Response.Write("lots of text...");
> Response.Write("lots of text...");
> Response.Write("</div>");
> }
> %>
> Thanks.
> Brian
>
Newbie: how to handle large response.write blocks
Is there a way to abbreviate the aspx below? Specifically, is there a
way to eliminate the response.write syntax and escaped characters?
<%
if (MyObject.SomeBoolean)
{
Response.Write("<div class=\"myclass\">");
Response.Write("You may have won 1,000,000 dollars...");
Response.Write("lots of text...");
Response.Write("lots of text...");
Response.Write("</div>");
}
else
{
Response.Write("<div class=\"error\">");
Response.Write("You should buy more magazines...");
Response.Write("lots of text...");
Response.Write("lots of text...");
Response.Write("</div>");
}
%
Thanks.
BrianIn C#, Not. If you want to have a literal quote in a string you have to place
the \ escape before it.
Regarding not having to type Response.Write so much, try stuffing all your
strings into a StringBuilder instance. At the end, you can write one time:
Response.Write(myStringBuilder.ToString());
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"Brian F" wrote:
> Hi everyone -
> Is there a way to abbreviate the aspx below? Specifically, is there a
> way to eliminate the response.write syntax and escaped characters?
> <%
> if (MyObject.SomeBoolean)
> {
> Response.Write("<div class=\"myclass\">");
> Response.Write("You may have won 1,000,000 dollars...");
> Response.Write("lots of text...");
> Response.Write("lots of text...");
> Response.Write("</div>");
> }
> else
> {
> Response.Write("<div class=\"error\">");
> Response.Write("You should buy more magazines...");
> Response.Write("lots of text...");
> Response.Write("lots of text...");
> Response.Write("</div>");
> }
> %>
> Thanks.
> Brian
>
newbie: how to print stuff at the shell using C# while at programming in asp.net
I want to able to see the certain value within the code itself. And I'm unable to use asp:label control.
Is there's any way I can print stuff on the shell so I can keep track of where I'm at with my varable?
I tried Console.Write(temp); but it didn't seem to work :(
TIA
Use one of the System.Diagnostics.Debug.Writexxx() methods. These will appear in the Output Window in Visual Studio as you run the site under the debugger.
Alternatively, use the HttpContext.Current.Trace.Write() method, and this will put output into the ASP.NET Trace, which you can either see on the page or via the trace.axd handler.
Thank you very much DMW, System.Diagnostics.Debug.Writexxx() is useful
case close
Newbie: how to navigate from one to another asp in the project
I have two asp-pages in my project.
There is a task on the first one, when the solution of the task ok, then
should the second page come. I made a menu for this. If the task solution
ok, then becomes the menu visible. Is it possible to activate automatically
the menu if the task solution ok? I mean, without the click on it? It it
possible to do all this simplier? I think somethink like this:
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button3.Click
If MySolution=true then
MySecondASPpage should be shown (what to entere here??)
end if
end sub
Thanks
BarbaraYou may want to use Response.Redirect("PageNameHere")
- V
Barbara Schmidt wrote:
Quote:
Originally Posted by
Hallo everybody!
I have two asp-pages in my project.
There is a task on the first one, when the solution of the task ok, then
should the second page come. I made a menu for this. If the task solution
ok, then becomes the menu visible. Is it possible to activate automatically
the menu if the task solution ok? I mean, without the click on it? It it
possible to do all this simplier? I think somethink like this:
>
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button3.Click
>
If MySolution=true then
>
MySecondASPpage should be shown (what to entere here??)
>
end if
>
end sub
>
>
>
Thanks
>
Barbara
Newbie: How to upload and save images using ASP.NET web forms (C#)
I need to upload images in my web application using ASP.NET web forms
(written in C#). Since i have never done this before, i am unsure what is the
best method.
I assume there are two options:
1). Upload the images and save the files directory to the windows file
system. However, i assume this poses a security risk, as the file directory
will require write permissions.
2). Save the images (as objects?) in the SQL SERVER database.
Can anyone suggest the best way to do this? And, if possible, point me to
some sample code or artciles which explain how to do this.
Thanks!Charlie,
check out the following article:
http://www.codeproject.com/aspnet/fileupload.asp
I prefer to save files in the database but it depends on your needs.
If you need to save hundred thousands of files and decide that you want to
save them on your hard disk make sure to distribute them on different
directories. What you could do is that you assign a guid to each file and
create your directory structure accordingly.
Example:
You have five files with the following guids
0A59E8D6-0AE5-475B-8698-814C2C712029
F16CE1B1-56D0-42E6-9463-A58D553CC289
D90C27C7 -8BD9-4F47-8CFE-DE9D240AD136
370B6080-DF06-4DDE-BB5E-85264B8AE48B
861DC387-FDC7-4A4F-B0C3-9EA6734A562A
You could now create a directory like the following:
0A59E8D6\0AE5\475B\8698\814C2C712029
F16CE1B1\56D0\42E6\9463\A58D553CC289
D90C27C7 \8BD9\4F47\8CFE\DE9D240AD136
370B6080\DF06\4DDE\BB5E\85264B8AE48B
861DC387\FDC7\4A4F\B0C3\9EA6734A562A
HTHs
Daniel
"charliewest" <charliewest@.discussions.microsoft.com> schrieb im Newsbeitrag
news:E6DD7087-DC4F-4E78-9741-0EF7F76883B6@.microsoft.com...
> Hello -
> I need to upload images in my web application using ASP.NET web forms
> (written in C#). Since i have never done this before, i am unsure what is
> the
> best method.
> I assume there are two options:
> 1). Upload the images and save the files directory to the windows file
> system. However, i assume this poses a security risk, as the file
> directory
> will require write permissions.
> 2). Save the images (as objects?) in the SQL SERVER database.
> Can anyone suggest the best way to do this? And, if possible, point me to
> some sample code or artciles which explain how to do this.
> Thanks!