T
Tim Thomas
Hi,
I am very new to .NET and am in the process of building my first web
application.
I will briefly describe what i am trying to achieve:
I have a system where suppliers register their details, their locations, and
then add themselves to categories. Each category requires additional info
from the suppliers, this additional category info is stored in its own DB
table. a suppliers may add themselves to as many categories as required.
the registration process is as follows:
1. enter personal details
2. select locations
3 select category
4 enter details for category
[upon successfully completing stage 4, option to go back to stage 3 and add
another category]
I have got to stage 3 ok,
this page has a dropdownList (and a button) to select the category, on
button_Click a user control dynamically loads into a placeholder on the
page, all works fine. this is the simplified code:
private void btnCategory_Click(object sender, System.EventArgs e)
{
Control myControl = LoadControl(DropDownList1.SelectedItem.Text.Replace
+ ".ascx");
PlaceHolder1.Controls.Add(myControl);
}
the control this loads is a simple webform page that has a form the supplier
fills out and a button to 'send' the form (the button is within the .ascx
user control). the button event should then add all the form data to a
sqlCommand to add the text in each box to the stored procedure parameters.
All this needs to happen withing the user control because it's quite
different for each category. i hope your following me!
when the control button is clicked all that happens is the page (that hosts
the user control) reloads, the control dissapears, and the stored procedure
(part of the button_click method within the user control) doesn't execute,
and all i'm left with is the dropdown list again.
What i need to happen is for the button_Click event to fire, do it's stuff
and inform the user they were added, and ask them if they would like to add
themselves to another category.
I'm sure i am missing something fundamental and simple, but as i said i'm
quite new to all this.
Any help is greatly appreciated.
Thanks
Tim..
I am very new to .NET and am in the process of building my first web
application.
I will briefly describe what i am trying to achieve:
I have a system where suppliers register their details, their locations, and
then add themselves to categories. Each category requires additional info
from the suppliers, this additional category info is stored in its own DB
table. a suppliers may add themselves to as many categories as required.
the registration process is as follows:
1. enter personal details
2. select locations
3 select category
4 enter details for category
[upon successfully completing stage 4, option to go back to stage 3 and add
another category]
I have got to stage 3 ok,
this page has a dropdownList (and a button) to select the category, on
button_Click a user control dynamically loads into a placeholder on the
page, all works fine. this is the simplified code:
private void btnCategory_Click(object sender, System.EventArgs e)
{
Control myControl = LoadControl(DropDownList1.SelectedItem.Text.Replace
+ ".ascx");
PlaceHolder1.Controls.Add(myControl);
}
the control this loads is a simple webform page that has a form the supplier
fills out and a button to 'send' the form (the button is within the .ascx
user control). the button event should then add all the form data to a
sqlCommand to add the text in each box to the stored procedure parameters.
All this needs to happen withing the user control because it's quite
different for each category. i hope your following me!
when the control button is clicked all that happens is the page (that hosts
the user control) reloads, the control dissapears, and the stored procedure
(part of the button_click method within the user control) doesn't execute,
and all i'm left with is the dropdown list again.
What i need to happen is for the button_Click event to fire, do it's stuff
and inform the user they were added, and ask them if they would like to add
themselves to another category.
I'm sure i am missing something fundamental and simple, but as i said i'm
quite new to all this.
Any help is greatly appreciated.
Thanks
Tim..