473,800 Members | 2,507 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

User control reloads page data when webcontrol changes

Howdy all
Been searching and can't find a good answer to my problem.

I've got a usercontrol 'banner' at the top of my page, and when the
selection in the dropdown list changes I want the "host" webform/page to be
reload so the data on it (in repeaters) is reloaded using a new value from
the dropdownlist (and which btw is also stored in a session variable for
later use).

I'm not sure the best way to do this.
I could call a public method in the page class and try and repopulate this
but I'm not sure that with the .NET page
creation/initiation/render/whatever-the-correct-term-is order that this will
work, plus I can't get it to work anyhow (maybe I need to call the
InitializeCompo nent method generated by VS) but I don't really know what I'm
doing re this.

I've tried redirect the "host" page to itself but then I'm having problems
getting the dropdownlist to show the (just) selected value.

I was hoping there was a simple way to call the "host" page_load event from
the user control as this would make it much easier, but I'm not sure this
makes sense the in the .NET page load/creation order anyway. I read
something about delegates but I didn't really understand it and couldn't see
how to apply it to my case.

Any help would be greatly appreciated.
Cheers
Matt

Nov 24 '05 #1
4 1889
Matt,
Problem of urs will be solved by checking for IsPostBack and do logic
for binding data to ur repeater control.

"Matt Jensen" wrote:
Howdy all
Been searching and can't find a good answer to my problem.

I've got a usercontrol 'banner' at the top of my page, and when the
selection in the dropdown list changes I want the "host" webform/page to be
reload so the data on it (in repeaters) is reloaded using a new value from
the dropdownlist (and which btw is also stored in a session variable for
later use).

I'm not sure the best way to do this.
I could call a public method in the page class and try and repopulate this
but I'm not sure that with the .NET page
creation/initiation/render/whatever-the-correct-term-is order that this will
work, plus I can't get it to work anyhow (maybe I need to call the
InitializeCompo nent method generated by VS) but I don't really know what I'm
doing re this.

I've tried redirect the "host" page to itself but then I'm having problems
getting the dropdownlist to show the (just) selected value.

I was hoping there was a simple way to call the "host" page_load event from
the user control as this would make it much easier, but I'm not sure this
makes sense the in the .NET page load/creation order anyway. I read
something about delegates but I didn't really understand it and couldn't see
how to apply it to my case.

Any help would be greatly appreciated.
Cheers
Matt

Nov 25 '05 #2
Good point, I think I must be going insane at the moment...!
:-)
Matt

"Santhi Maadhaven" <Sa************ *@discussions.m icrosoft.com> wrote in
message news:D8******** *************** ***********@mic rosoft.com...
Matt,
Problem of urs will be solved by checking for IsPostBack and do logic
for binding data to ur repeater control.

"Matt Jensen" wrote:
Howdy all
Been searching and can't find a good answer to my problem.

I've got a usercontrol 'banner' at the top of my page, and when the
selection in the dropdown list changes I want the "host" webform/page to
be
reload so the data on it (in repeaters) is reloaded using a new value
from
the dropdownlist (and which btw is also stored in a session variable for
later use).

I'm not sure the best way to do this.
I could call a public method in the page class and try and repopulate
this
but I'm not sure that with the .NET page
creation/initiation/render/whatever-the-correct-term-is order that this
will
work, plus I can't get it to work anyhow (maybe I need to call the
InitializeCompo nent method generated by VS) but I don't really know what
I'm
doing re this.

I've tried redirect the "host" page to itself but then I'm having
problems
getting the dropdownlist to show the (just) selected value.

I was hoping there was a simple way to call the "host" page_load event
from
the user control as this would make it much easier, but I'm not sure this
makes sense the in the .NET page load/creation order anyway. I read
something about delegates but I didn't really understand it and couldn't
see
how to apply it to my case.

Any help would be greatly appreciated.
Cheers
Matt

Nov 25 '05 #3
Hmm, I think my problem is related to the order of a dropdownlist
selectindexchan ged event firing in relation to the page ispostback event.
Which fires first?
Cheers
Matt

"Santhi Maadhaven" <Sa************ *@discussions.m icrosoft.com> wrote in
message news:D8******** *************** ***********@mic rosoft.com...
Matt,
Problem of urs will be solved by checking for IsPostBack and do logic
for binding data to ur repeater control.

"Matt Jensen" wrote:
Howdy all
Been searching and can't find a good answer to my problem.

I've got a usercontrol 'banner' at the top of my page, and when the
selection in the dropdown list changes I want the "host" webform/page to
be
reload so the data on it (in repeaters) is reloaded using a new value
from
the dropdownlist (and which btw is also stored in a session variable for
later use).

I'm not sure the best way to do this.
I could call a public method in the page class and try and repopulate
this
but I'm not sure that with the .NET page
creation/initiation/render/whatever-the-correct-term-is order that this
will
work, plus I can't get it to work anyhow (maybe I need to call the
InitializeCompo nent method generated by VS) but I don't really know what
I'm
doing re this.

I've tried redirect the "host" page to itself but then I'm having
problems
getting the dropdownlist to show the (just) selected value.

I was hoping there was a simple way to call the "host" page_load event
from
the user control as this would make it much easier, but I'm not sure this
makes sense the in the .NET page load/creation order anyway. I read
something about delegates but I didn't really understand it and couldn't
see
how to apply it to my case.

Any help would be greatly appreciated.
Cheers
Matt

Nov 25 '05 #4
Matt,
What I've used a lot in the past

1. Ensure that your DropDownList control has "AutoPostBa ck = true"
set.
2. Create a handler for the SelectedIndexCh anged event from the
DropDownList.
3. In the handler add code that looks something like this

private void DropDownList1_S electedIndexCha nged(object sender,
System.EventArg s e)
{
// Get the selected value from the DDL
string selectedValue = DropDownList1.S electedValue;

// Call a function to update the repeaters with the
// the new value from the DDL control
UpdateRepeaters (selectedValue) ;
}

In this manner, you can use the postback event to udpate the repeaters
on your page.

Hope this helps.

-tomas
On Fri, 25 Nov 2005 15:22:06 -0000, "Matt Jensen"
<re************ ***@microsoft.c om> wrote:
Hmm, I think my problem is related to the order of a dropdownlist
selectindexcha nged event firing in relation to the page ispostback event.
Which fires first?
Cheers
Matt

"Santhi Maadhaven" <Sa************ *@discussions.m icrosoft.com> wrote in
message news:D8******** *************** ***********@mic rosoft.com...
Matt,
Problem of urs will be solved by checking for IsPostBack and do logic
for binding data to ur repeater control.

"Matt Jensen" wrote:
Howdy all
Been searching and can't find a good answer to my problem.

I've got a usercontrol 'banner' at the top of my page, and when the
selection in the dropdown list changes I want the "host" webform/page to
be
reload so the data on it (in repeaters) is reloaded using a new value
from
the dropdownlist (and which btw is also stored in a session variable for
later use).

I'm not sure the best way to do this.
I could call a public method in the page class and try and repopulate
this
but I'm not sure that with the .NET page
creation/initiation/render/whatever-the-correct-term-is order that this
will
work, plus I can't get it to work anyhow (maybe I need to call the
InitializeCompo nent method generated by VS) but I don't really know what
I'm
doing re this.

I've tried redirect the "host" page to itself but then I'm having
problems
getting the dropdownlist to show the (just) selected value.

I was hoping there was a simple way to call the "host" page_load event
from
the user control as this would make it much easier, but I'm not sure this
makes sense the in the .NET page load/creation order anyway. I read
something about delegates but I didn't really understand it and couldn't
see
how to apply it to my case.

Any help would be greatly appreciated.
Cheers
Matt


Nov 28 '05 #5

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

Similar topics

3
2565
by: Tim Thomas | last post by:
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....
6
1921
by: Mary Kerrigan | last post by:
I have a user control (menu) with a data list: <asp:DataList id="MyList" runat="server"> <ItemTemplate> <asp:hyperlink cssclass="MenuUnselected" id="myLink1" Text='<%# Container.DataItem("Subject") %>' NavigateUrl='<%# "../productlist.aspx?SubjectID=" & Container.DataItem("SubjectID") & "&selection=" & Container.ItemIndex
19
2991
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and provide an open TD with a DIV in it for the content of this formlet. (The DIV is for DHTML to hide and show the content) I've created a web page showing step by step the two problems I'm encountering. This problem is much easier to see than it...
6
11304
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header" Src="WebControls/Header.ascx" %> The web user control contains the following server controls
1
1022
by: Reza Nabi | last post by:
Bakground: I have a webform (LoadCtl.aspx) which loads the user control to a placeholder dynamically based on the ctlName querystring passed in the URL. Webform (LoadCtl.aspx) also passes a variable (targetId) in to the usercontrol (IntergySite.aspx) by calling its setter method. Currently, I am using if-then-else and hardcoded the User Control Object to do casting and call the setter method. Question: Is there any way I could load,...
5
3598
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact that for server control component , code is running on the server side. But if I take as example a Label. I place on a webform an HTM label control and a WebForm label control, I could see that properties are different for
2
4926
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is being updated by some other process through remoting. When the page loads, I init the tree, and in my browser I can see the initialized tree. The problem is that every time that I receive update to tree from the remote process,
8
17004
by: Mats Lycken | last post by:
Hi, I'm working on a webproject where I have several different user controls loaded on a WebForm. A problem arises when I in one webcontrol makes a change that should be picked up by another user control. For example a webshop. I have a datagrid of products in the shopping cart in one user control. In another I have an overview of the shopping cart (lists the products and a shows an order total). When I remove a product from my datagrid...
9
1738
by: cosmos411 | last post by:
Hi everyone, I have a captcha type of user control that's on a contact page. The problem is that when the user hits Submit it reloads the user control and changes the captcha inside the control before I have a chance to validate against it. This causes the validation to always fail. I was wondering why this happens and what I can do about it. Sorry for being so vague, but this is the best way I can describe the problem. Thanks to...
0
9551
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10504
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10274
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10251
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.