|
I'm currently taking an HTML course and I'm seriously kicking myself with this one. Our professor released a very basic form in HTML (I will be including it at the end of the message) and it's pretty much a form to create an account and it asks some basic questions such as age and transport method.
He then released a continuation to that page which grabs all the information and depending on what you answered you get certain information on the screen. Pretty much an if exercise. He had us add a couple more options to test our coding skills and I cannot get the information to carry over.
Form:
<form>
First name: <input type="text" name="firstname" />
Last name: <input type="text" name="lastname" />
Username: <input typ="text" name="user" />
Password: <input type="password" name="pwd" />
<input type="radio" name="sex" value="male" /> Male
<input type="radio" name="sex" value="female" /> Female
<input type="radio" name="mstatus" value="single" /> Single
<input type="radio" name="mstatus" value="married" /> Married
<input type="checkbox" name="vhicle" value"Bike" /> I have a bike
<input type="checkbox" name="vhicle" value"Car" /> I have a car
<input type="checkbox" name="pet" value"dog" />I have a dog
<input type="checkbox" name="pet" value"cat" />I have a cat
<input type="submit" value="Submit" />
<form name="input" action="html_form_action.asp" method="get">
ASP continuation code:
pwd = Request.Form("pwd")
Response.Write("The user's name is " & firstname & " ")
Response.Write("The user's last name is " & lastname & " ")
Response.Write("The username is " & user & " ")
Response.Write("Password: " & pwd & " ")
operacion1=request.form("sex")
if (operacion1="male") then
response.write("Is a man.")
else
response.write("Is a woman.")
end if
operacion2=request.form("age")
if (operacion2="15-25") then
Response.Write("Is young.")
else
Response.Write("Is old.")
end if
operacion3=request.form("vhicle")
if (operacion3="Bike") then
Response.Write("Is cyclist.")
else
Response.Write("Is a driver.")
else
end if
operacion4=request.form("mstatus")
if (operacion4="single") then
Response.Write("Needs a blind date.")
else
Response.Write("Rest in peace.")
end if
operacion5=request.form("pet")
if (operacion5="dog") then
Response.Write("Hates cats.")
else
Response.Write("Hates dogs.")
end if
%>
I'm very new to this and I recognize that is very basic. This is just homework, not worth any points, voluntary for those who don't want to damage their conscience with helping another cheat. I'm taking the course in Spanish so don't b throwned off by some of the odd sounding variables.
|
|
|
|
|
I'm sorry, but what exactly is your question?
--
"My software never has bugs. It just develops random features."
|
|
|
|
|
After I input all the information on the htm form, the submit button does not carry out my information. It just refreshes itself and the same form appears on screen.
|
|
|
|
|
So it depends what is before line:
ASP continuation code:
After you click submit, page reloads and quite a few events are fired that will let you handle information posted on form. You should override page_load event possibly checking the if it was postback and then process the information.
--
"My software never has bugs. It just develops random features."
|
|
|
|
|
That's a whole other from the HTM form should end in . I worked with the code a little last night and fixed a lot of errors, but from what I understand they had nothing to do with the asp file retaining my info and displaying the information.
|
|
|
|
|
Oh, it looks like I completly misunderstood your problem. Your code is classic ASP, not ASP.NET, right?
In that case I'm affraid I can't help you as I have very little experience with it
--
"My software never has bugs. It just develops random features."
|
|
|
|
|
deflinek wrote: Oh, it looks like I completly misunderstood your problem. Your code is classic ASP, not ASP.NET, right?
In that case I'm affraid I can't help you as I have very little experience with it
Oh I seriously did not noticed the .NET. I'm apologize for posting on the wrong forum. If I could get a mod tom move this to the right section this would be great. Thanks for trying to take on my problem. I'm still trying to figure this out lol.
|
|
|
|
|
how to fetch in linq to sql server
soumyashree sahoo
|
|
|
|
|
|
hi guys. im kinda new here. so please help me on my first web page using asp.net.
i cant figure out to insert an image into a table please help
|
|
|
|
|
Well, you need to design a webpage where you place a table and then image in one of it's row/column.
Example:
<table>
<tr>
<td>
<asp:Image ID="myImage" runat="source" ImageUrl="~/MyPicture.png" />
</td>
</tr>
</table>
|
|
|
|
|
Hi Guys,
I am loading buttons on a page load event dynamically. The buttons are added to a placeholder control on a aspx page. The problem I am having is that the dynamically created button event below (topic_Click) doesn't get fired.
Bascially, I am trying to add topics to aobjective.
Could you please help me. I would highly appreciate it.
protected void Page_Load(object sender, EventArgs e)
{
if (Session["s"] == null)
{
AddObjective();
AddTopic();
}
else if (Session["s"] != null)
{
List<Panel> list = new List<Panel>();
list = Session["s"] as List<Panel>;
foreach (var item in list)
{
AddtoPlaceHolder(item);
}
}
}
private void AddObjective()
{
Panel panel = new Panel();
Button objective = new Button();
objective.Text = "Add objective";
objective.Click += new EventHandler(objective_Click);
panel.Controls.Add(objective);
placeholder.Controls.Add(panel);
AddtoPlaceHolder(panel);
}
void AddtoPlaceHolder(Panel panel)
{
if (Session["s"] == null)
{
List<Panel> list = new List<Panel>();
list.Add(panel);
Session.Add("s", list);
}
else if(Session["s"] !=null)
{
List<Panel> list = Session["s"] as List<Panel>;
list.Add(panel);
Session.Add("s", list);
}
}
void objective_Click(object sender, EventArgs e)
{
if (Session["s"] != null)
{
AddObjective();
}
}
void topic_Click(object sender, EventArgs e)
{
throw new NotImplementedException(); =======> Problem doesn't execute
}
private void AddTopic()
{
Panel paneltopic = new Panel();
paneltopic.ID = Guid.NewGuid().ToString();
Button topic = new Button();
topic.ID = Guid.NewGuid().ToString();
topic.Text = "Insert topic";
topic.Click += new EventHandler(topic_Click);
paneltopic.Controls.Add(topic);
placeholder.Controls.Add(paneltopic);
AddtoPlaceHolder(paneltopic);
}
|
|
|
|
|
protected void topic_Click(object sender, EventArgs e)
{
throw new NotImplementedException(); =======> Problem doesn't execute
}
private void AddTopic()
{
Panel paneltopic = new Panel();
paneltopic.ID = Guid.NewGuid().ToString();
Button topic = new Button();
topic.ID = Guid.NewGuid().ToString();
topic.Text = "Insert topic";
topic.Click += new System.EventHandler(this.topic_Click);
paneltopic.Controls.Add(topic);
placeholder.Controls.Add(paneltopic);
AddtoPlaceHolder(paneltopic);
}
[code behind event handlers^]
|
|
|
|
|
if you copy and past the code from another page visual studio may change the name of the button check the the ButtonID if its correct with the code
|
|
|
|
|
You should probably tell the OP that, and not me.
The button ID has nothing to do with generating a postback to the server. In fact, you don't need the .ID attribute in code behind, it's there to support java script and css on the client side.
His problem is that he didn't generate a new event object, and just made a reference to an uninitialized event object.
|
|
|
|
|
I see here codebehind but what if on the design side button name is not "topic"
what if the button name was "button1"
thats what i am try to tell and its very possiable if you copy and past the design code
|
|
|
|
|
i m hosting a web site i want my one web page to be run on one pc only in vb.net code or javascript code
plz help me urgent
|
|
|
|
|
I do not give a rats' hair about this being urgent. I just woke up, still enjoying the first cup of coffee.
Keeping others of your website is done using a login-form. There are a lot of examples and tutorials on the internet. Alternatively, you could use certificates. But no, not in JavaScript. Anyone can download that and simply use it to log in.
I assume it's an ASP.NET website, not PHP?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Are you running in a network i.e. do u have active directory
|
|
|
|
|
You're replying to the wrong person
|
|
|
|
|
You have already asked this in QA. And I checked my schedule, it's not urgent at all.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
You really should of put a little more thought into that question before you just blurted it out as something that doesn't really make sense. It sounded like a 10 year old wanting ice cream now.
So let now go back to elementary school here to try and figure out what you said.
1. Your hosting a website.
2. run a web page on just 1 PC only
3. you want it to be written in Javascript or vb.
Now that the translation is complete
1. If your hosting a website, then you must have the knowledge to perhaps just load that website on the 1 PC only, so it is localized, and cannot be shared with other computers. Windows Professional and Business Editions come with IIS server for local web hosting.
3. You can host, but can't write one, There are many tutorials out there that will guide you through the process of learning how to write HTML
You have to learn HTML first, before you can write any asp.net or Javascript. All you need is notepad, and a small web server to get started. The links below will get you started in an urgent manner.
http://www.html.net/tutorials/html/introduction.php[INtroduction to HTML^]
http://www.wikihow.com/Create-a-Simple-Web-Page-With-HTML[^]
|
|
|
|
|
In my page i have a grid. There ia check box column.After I select some of the records or all the records I am doing a time taking operation.I,e on button click i want do a long database operation on the selected records and also calling a separate exe which will do some operation on each record. I want to allow the user to move to a different page and do some other work and when the user again come back to that page where the long process was going on.I was trying to achieve it through async page functionality, but lster on thought thst if i move to a different page then how can i do that button click operation, because that page is no more existing. Can anybody put some idea on this. If the question is not clear then please ask me.I don't want to call a web service for this operation. Suppose I have a procedure dosomething().On button click i want to call dosomething() and can move to different page. and again come back the operation should have beeen finished. I have a label on the page which will be updated with the text as operatuin completed successfully or some error message. I will be greatful to you please put your idea on this. with some little code sample.
|
|
|
|
|
Well someone correct me if I'm wrong here,
If you change pages, then the process will continue to run, until the server is alerted that the user is no longer on that page, so when the answer is ready, that page won't be there anymore to receive the answer. It will have destroyed the old page, and moved on to the new page with complete disregard for the old page.
When the request is made, the server will send back a success code, and the browser will wait for the html stream, or response stream.
In order to send small amounts of html back to the page while waiting, you have to put something in the response buffer, and dump the buffer back to the browser, so it will not timeout, until your main response buffer is ready to complete the process.
If you use an iFrame, that's like splitting a browser into 2, in which several processes can run at the same time to different servers.
But in hind sight, if you can't write code for the response buffer, to send html every 10 seconds or so, then the whole thing will timeout on you.
|
|
|
|
|
Hi jkirkerx
Thanks a lot for your suggestion. Actually I am a desktop application developper. In windows application normally I use threading for this kind of requirement.I am very much new to web development.So I thought, is it really posible to do something like this.
Thanks
Prashant
|
|
|
|