Howdy guys! I need help with something (yes, again). What my plan is, is to have two user inputs on a website, one of these inputs will be the header for the html e.g. "DaniWeb TechTalk computer support", the other for the page content, e.g. "Hi, my name is zorba...". This data needs to be saved to an aspx file, and once that has been done, another aspx page has to display the header or title of the page e.g. "Daniweb TechTalk computer support" with a link to the aspx. Now I have thought about this a little and the input from the users can be saved into label controls in the text property. Another thing is I could have an aspx page template so that the page only needs to be copied from that and the labels inserted in the right spot. Now what I don't know is how to do this heh ;) I really hope you guys can help me with this one because I'm not sure I will be able to figure it out by myself. I have faith in you guys.

Thanks heaps for your time,

Slade

Note: I am using VB .NET for the code behind

Recommended Answers

All 23 Replies

Maybe I am just tried, but what I have read of your question has left me confused? What are you saying with regards to header and inputs are confusing?

ne of these inputs will be the header for the html e.g. "DaniWeb TechTalk computer support", the other for the page content, e.g. "Hi, my name is zorba...".

You are talking here about Display Controls, but refer to them as inputs? Is the user to supply the information to create these "inputs" or "controls"?

Why not have the user supply the information, store that information in a cookie, and then redirect to the next aspx page and use the cookie information to generate the "inputs" you need?

Not sure this helps, but your question is a little vague and confusing.....but then again I am tired! :rolleyes:

lol it's cool buddy... I think that's the info I need. What I'm talking about thought is this:

<html>
<hea><title>(user input goes here)</title>
<Body>
(User input goes here)
</body>
</html>

does that clear it up for you?

Yeah that is what I had figured. Glad I could help. ASP.Net is something I am learning right now as well.

Happy coding!!!

There is still more problems... how do I save this page on the server (after user inputs have been made) and how do I make the link to the page automatically appear on the home page? (has the same name as the page title). SO we have figured out how to pass the values onto another page, but how do we save that page once the "submit page" button has been pressed?

is it possible for vs .net just to copy an allready existing page and edit that? Like a template?

You mean modify it on the fly? Hmm, not that I am aware of, but .NET is pretty powerful, I wouldn't doubt there is a way!

can you think of any other ways I can do this? Just so that a user can put inputs for the title of the html page and also the body. PLEASE! if you can think of a way to do this than I would give you a special thanks on the actual site, paladine, tekmaven, you allready get one.


Slade

p.s. you too dani, and a link to this site because it is the best lot of forums I have come across.

It is 1:30 am right now, and my mind is mush! But I will see what I can come up with by the end of the weekend dude! But I am sure I have some source code somewhere in my IT Library Drive that may help....no promises. :-)

As of right now I am off to bed.

THanks dude, you truly are a good help.

Hey man, I looked into it, and there is no way to do it aside from the means we have been tossing around.

Sorry...let you know if things change!

So then it is possible?

Well sort of. You have a "template" page that will be loaded, but the controls are customized by passed values/variables from the user selection (via session objects).


i.e. Allowing the user to select the background color and text color on a particular page. Done this many times in my chat forum with Java, and ASP.Net is no different.


Hope that made sense??

oh I see, so I can't just link the template page to a style sheet?

Do you know any of the code for this?

Slade - If I am still following things (getting older you know...so I could be loosing it :mrgreen: ), then here is some sample code that I am thinking will point you in the right direction. As well this is how I understood what you wanted.

Page 1: ' ||||| Partial Code only ||||||

' ||||| Partial Code only ||||||
<form id="Form1" method="post" runat="server">
     <asp:ListBox id="ListBox1" runat="server" Width="102px" Height="78px">
     <asp:ListItem>Red</asp:ListItem>
     <asp:ListItem>Blue</asp:ListItem>
     <asp:ListItem>Green</asp:ListItem>
     </asp:ListBox>
<br>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button>
</form>

Code Behind for Page 1: ' ||||| Partial Code only ||||||

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Session("MyColor") = ListBox1.SelectedItem.Text
        Response.Redirect("Result.aspx")
End Sub

Page 2: ' ||||| Partial Code only ||||||

<form id="Form1" method="post" runat="server">
 <asp:Label runat="server" ID="lblColor" >You picked a very nice color!     </asp:label>
</form>

Code Behind for Page 2: ' ||||| Partial Code only ||||||

Imports System.Drawing
....
....
 Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        lblColor.BackColor = Color.FromName(Session("MyColor"))
End Sub

Hope this helps dude! :)

Yeah it does thanks! But what code do I use to transfer it from page to page as a cookie? Sorry lol, I'm really new to cookies on asp .net and my knowledge is very limited.

Ah, no worries dude!

Basically the same way.

Response.Cookies("MyColor") = Listbox1.SelectedItem.Text

You can even set them with Keys (Key values that is)

e.x

Response.Cookies("SladesColorPick")("MyColor") = ListBox1.SelectedItem.Text

Happy coding!

so you store them in a cookie, and I can call back that cookie value on another page?

Yup, just like using the session object.

Cool thanks so much!

Hi,
I am trying to change the backcolor System.Web.UI.WebControls.Button btn1 at runtime, but it doesn't work. The color of the button change at all. :mad:

<asp:button id="btn1" style="Z-INDEX: 383; LEFT: 192px; POSITION: absolute; TOP: 160px" runat="server" Height="16px" Width="16px"></asp:button>

Code Behind:
pageload()
{ :mad:
btn.BackColor = Color.Cyan;
}

Please help. :sad:

Hope this helps:

Change Button Control

:mrgreen:

Hi,
I am trying to change the backcolor System.Web.UI.WebControls.Button btn1 at runtime, but it doesn't work. The color of the button change at all. :mad:

<asp:button id="btn1" style="Z-INDEX: 383; LEFT: 192px; POSITION: absolute; TOP: 160px" runat="server" Height="16px" Width="16px"></asp:button>

Code Behind:
pageload()
{ :mad:
btn.BackColor = Color.Cyan;
}

Please help. :sad:

This should solve the problem i guess

btn1.BackColor = System.Drawing.Color.Crimson;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.