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.Replac e
+ ".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.. 3 2539
Hello Tim,
Just put a break point on the buttons click event in the code behind file.
and step into it.
look at the various condition in the watch windows maybe some conditions you
thought didnt work that way.
regards,
HD
"Tim Thomas" <br*********@hotmail.com> wrote in message
news:bn***********@news.wplus.net... 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.Replac e + ".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..
Thanks HD,
I tried what you said, and it seems the code didn't even hit the breakpoint,
so i couldn't see why the button click event in the user controls code
behind wasn't firing
It seems to me that clicking the button (which is part of the user control)
on the page embedding the user control just reloads/does a post back for the
page [hosting the control]- it doesn't fire any of the events in the user
control :@
Any other suggestions appreciated
Tim..
"HD" <he***********@CAPShotmail.com> wrote in message
news:Or**************@TK2MSFTNGP10.phx.gbl... Hello Tim,
Just put a break point on the buttons click event in the code behind file. and step into it. look at the various condition in the watch windows maybe some conditions
you thought didnt work that way.
regards,
HD
"Tim Thomas" <br*********@hotmail.com> wrote in message news:bn***********@news.wplus.net... 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.Replac e + ".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..
Quick one Tim,
The button is on a user control so how are you capturing the event. Think
you'll have to go a bit deeper.
With custom controls you have to inherit from IPostBackDataHandler and
implement its RaisePostDataChangedEvent.
I am still trying to figure out how to return the control to the control's
container (Fire a custom event for the page possibly)
so that any other manipulation other than that one the control goes through
as well post the controls data manipulation,
Dont think it will help to that an extent,
HD
"Tim T" <br*********@hotmail.com> wrote in message
news:bn***********@news.wplus.net... Thanks HD, I tried what you said, and it seems the code didn't even hit the
breakpoint, so i couldn't see why the button click event in the user controls code behind wasn't firing It seems to me that clicking the button (which is part of the user
control) on the page embedding the user control just reloads/does a post back for
the page [hosting the control]- it doesn't fire any of the events in the user control :@ Any other suggestions appreciated
Tim..
"HD" <he***********@CAPShotmail.com> wrote in message news:Or**************@TK2MSFTNGP10.phx.gbl... Hello Tim,
Just put a break point on the buttons click event in the code behind
file. and step into it. look at the various condition in the watch windows maybe some conditions you thought didnt work that way.
regards,
HD
"Tim Thomas" <br*********@hotmail.com> wrote in message news:bn***********@news.wplus.net... 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.Replac e + ".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..
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Tim T |
last post by:
Hi,
I have the need to use dynamically loaded user controls in a webform page.
I have the controls loading dynamically, and that part works fine. this is
the code used in a webform to dynamically...
|
by: Frank Schumacher |
last post by:
Hi Folks,
I have a problem with the order of events fired by ASP.NET. I found many
articles which explaining the lifecycle of a site, but I found none
which took the event from a Control on the...
|
by: I am Sam |
last post by:
Please help. I'm dying here and pulling out the last few remaining elements
of my hair over this.
I have built a form that will identify and authenticate users. I keep
getting the following...
|
by: ~~~ .NET Ed ~~~ |
last post by:
I have a problem (don't we all?). I have a web form with multiple modules,
some of these modules have an ASP.NET (server run) button.
OK, now I have UserControlX which has one such button (say...
|
by: EvelynAnd Ethan |
last post by:
Hi,
ItemCommand event not firing from a dynamic user control ,WHERE A
DATAGRID HAS BUTTON,when i click on the linkbutton first time the
itemcommand event doesnt fire,second time event fires up
...
|
by: thedotnetarchitect |
last post by:
Can anyone tell me why my page load event is firing more then once? I
have a asp.net 2.0 page with four user controls and it seems that the
user controls are loading but the page load event seems...
|
by: TS |
last post by:
I am creating a User control and i create some dynamic controls in the init
handler. one of the controls is a custom validator which i assign a
serverValidate event handler. I usally always do my...
|
by: John |
last post by:
I am loading my controls dynamically into my asp.net page. When I click on a
button on one of those user controls then page reloads and I need to reload
the page based on what has happened in the...
|
by: John Kotuby |
last post by:
Hi guys,
I am converting a rather complicated database driven Web application from
classic ASP to ASP.NET 2.0 using VB 2005 as the programming language. The
original ASP application works quite...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |