473,322 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Loading a User Control on an ASPX

C
Hi,

I have an ASP.NET Page.

My page has a user control which is added to a panel programmatically.

My user control has a series of dropdowns.

When the user selects some values and clicks on submit when the postback
happens I need to reload the ascx each time. This is fine.

However as I reload it the dropdowns on the ascx are repopulated as I call
some methods in the Page_Load of my ascx in order to fill the dropdowns.

As a result the selected values are lost.

Anyne know how I can overcome this problem?

Thanks in Advance.
Nov 8 '06 #1
2 1093
Try encompassing your logic in Page_Load with

if(! IsPostBack)
{
<code>
}

-dl

---
David Longnecker
Web Developer
http://blog.tiredstudent.com
Hi,

I have an ASP.NET Page.

My page has a user control which is added to a panel programmatically.

My user control has a series of dropdowns.

When the user selects some values and clicks on submit when the
postback happens I need to reload the ascx each time. This is fine.

However as I reload it the dropdowns on the ascx are repopulated as I
call some methods in the Page_Load of my ascx in order to fill the
dropdowns.

As a result the selected values are lost.

Anyne know how I can overcome this problem?

Thanks in Advance.

Nov 8 '06 #2
move the init logic to oninit.

-- bruce (sqlwork.com)

"C" <C@discussions.microsoft.comwrote in message
news:6D**********************************@microsof t.com...
Hi,

I have an ASP.NET Page.

My page has a user control which is added to a panel programmatically.

My user control has a series of dropdowns.

When the user selects some values and clicks on submit when the postback
happens I need to reload the ascx each time. This is fine.

However as I reload it the dropdowns on the ascx are repopulated as I call
some methods in the Page_Load of my ascx in order to fill the dropdowns.

As a result the selected values are lost.

Anyne know how I can overcome this problem?

Thanks in Advance.

Nov 8 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: John | last post by:
Hi all, I'm having a little problem understanding the concepts of dynamically loading/unloading user conrols: 1. If I have a couple of usercontrols embedded within a few tables cells on my...
1
by: Martine | last post by:
Hi there! I have a problem with programmatically adding user controls to my mobile webforms. If I load my usercontrol programmatically (in the Page_Load), the object is instantiated, I have...
2
by: Eric | last post by:
I'm trying to dynamically load a user control using on the .NET framework (not Visual Studio). The control was designed in Visual Studio and is named: Disable.ascx The first line is: <%@...
0
by: Erwan | last post by:
I have a strange (but very blocking) result when using the smtpmail class from an ASPX page : here is the (very simple !) code... '-------------------------------------------------- mail.To =...
3
by: Seth Broomer | last post by:
Hi, i have a .aspx Page, inside that page is a web user control. The user control is basically a login control. if the user is logged in the page shows one thing. if the user isn't logged in...
1
by: kanones | last post by:
Hi - I am seeing some performance degradation when I am loading a control dynamically onto a page with multiple other dynamical controls using Page.LoadControl versus dragging and dropping it...
5
by: footballhead | last post by:
I have a site that has MANY different clothing categories. I have a page set up for displaying the products (productsearch.aspx) when a user clicks one of the category links on the navigation menu....
2
by: Dave A | last post by:
I just don't get this... If I need to dynamically load controls into a web page I simply need to go PlaceHolder1.Controls.Add(new Button()); or similar. However when I need to dynamically...
5
by: =?Utf-8?B?V2FubmFiZQ==?= | last post by:
We have a page that is loading very slow. There is not a lot of data, not a lot of users are connected at the same time and the page does not produce an error, so I am not sure where to start to...
0
by: AndySummers | last post by:
Hi We have just re-written a majour asp.net project to use a user control embedded in a web page. The main dll references 3 other custom controls and so to deploy the project I copy the 4 dll's to...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.