473,480 Members | 5,041 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Probleme mit LoadControl

Hallo zusammen,

ich kämpfe seit Tagen mit folgendem Problem und habe bisher leider
keine Lösung gefunden. Vielleicht kann mir jemand helfen:

Ich möchte auf einer Seite (test.aspx) ein bestimmtes UserControl
(Kunden.ascx) dynamisch per LoadControl mehrmals einbinden. Dabei soll
dem UserControl jeweils eine andere Variable (Anfangsbuchstabe des
Kunden) übergeben werden (z.B. per Session-Variable) übergeben
werden.

Beispiel:

Test.aspx:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Session("KundenBuchstabe") = "A"
plcHldTest.Controls.Add(LoadControl("Kunden.ascx") )

Session("KundenBuchstabe") = "B"
plcHldTest.Controls.Add(LoadControl("Kunden.ascx") )

Session("KundenBuchstabe") = "F"
plcHldTest.Controls.Add(LoadControl("Kunden.ascx") )

End Sub

Kunden.ascx:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

przHoleKunden(Session("KundenBuchstabe"))
'holt Kunden in einer eigenen Prozedur (via Data-List)
End Sub

Nun zum Problem:
Wenn ich test.aspx aufrufe, erhalte ich im UserControl "Kunden.ascx"
dreimal die Kunden mit dem Anfangsbuchstaben "F". Die Einbindung der
UserControls scheint also zu klappen (da 3x), aber immer nur mit der
Session-Variable Session("KundenBuchstabe") = "F".

Woran liegt das und wie kann ich dieses Problem in den Griff bekommen?

Vielen Dank für einen Lösungsansatz.

Andreas

P.S. Auch die Übergabe der Variable via Property (Get, Set) bringt das
gleiche Ergebnis.

Mar 4 '06 #1
1 1786
you have entered the english discussion group. ask your question in english
and we may be able you help you
--
mensuur
"Andreas" wrote:
Hallo zusammen,

ich kämpfe seit Tagen mit folgendem Problem und habe bisher leider
keine Lösung gefunden. Vielleicht kann mir jemand helfen:

Ich möchte auf einer Seite (test.aspx) ein bestimmtes UserControl
(Kunden.ascx) dynamisch per LoadControl mehrmals einbinden. Dabei soll
dem UserControl jeweils eine andere Variable (Anfangsbuchstabe des
Kunden) übergeben werden (z.B. per Session-Variable) übergeben
werden.

Beispiel:

Test.aspx:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Session("KundenBuchstabe") = "A"
plcHldTest.Controls.Add(LoadControl("Kunden.ascx") )

Session("KundenBuchstabe") = "B"
plcHldTest.Controls.Add(LoadControl("Kunden.ascx") )

Session("KundenBuchstabe") = "F"
plcHldTest.Controls.Add(LoadControl("Kunden.ascx") )

End Sub

Kunden.ascx:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

przHoleKunden(Session("KundenBuchstabe"))
'holt Kunden in einer eigenen Prozedur (via Data-List)
End Sub

Nun zum Problem:
Wenn ich test.aspx aufrufe, erhalte ich im UserControl "Kunden.ascx"
dreimal die Kunden mit dem Anfangsbuchstaben "F". Die Einbindung der
UserControls scheint also zu klappen (da 3x), aber immer nur mit der
Session-Variable Session("KundenBuchstabe") = "F".

Woran liegt das und wie kann ich dieses Problem in den Griff bekommen?

Vielen Dank für einen Lösungsansatz.

Andreas

P.S. Auch die Ãœbergabe der Variable via Property (Get, Set) bringt das
gleiche Ergebnis.

Mar 4 '06 #2

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

Similar topics

2
3010
by: grigoo | last post by:
bonjour a tous je me presente a vous::: greg dit le grigoo sur le web ,,etudiant en bioinformatique a montreal et jusqu au cou dans notre language prefere....java. et biojava.. et je suis en un...
0
1831
by: George Durzi | last post by:
I have a C# in my web application called BasePage. It inherits from System.Web.UI.Page. I'm using page inheritance in my web app so all my pages have an identical look and feel by inheriting from...
3
2997
by: Robert Walter | last post by:
I want to user the Page method LoadControl inside the Global.asax.cs but when I instantiate a page and try it I get the following error... System.NullReferenceException: Object reference not set...
10
4369
by: Umut Tezduyar | last post by:
It seems, it is caching it. The following code is an example for it. How can avoid from this. override void OnLoad (sender and eventargs) { Control control = this.LoadControl (path);...
8
5223
by: Sam Kuehn | last post by:
How do I accomplish the fallowing (is it even possible). Say I write a UserControl "MyControl.ascx". Now I use LoadControl("MyControl.ascx"). But I really want MyControl to require parameters in...
2
3654
by: Keith Patrick | last post by:
Maybe my expectations are just too low because I haven't read much documentation on this method, but basically, I am trying to load a user control dynamically without using a virtual path (I have...
1
2298
by: Joe | last post by:
Hello All, I have a class that inherits from System.Web.UI.Page. In it I call the Page.LoadControl. I am having trouble with the virtual path that the LoadControl method accepts as its...
0
1178
by: MattB | last post by:
I'm making a reusable class to load and populate user controls based on database values. I had the basic code working from codebehind, and now I'm moving it to a reusable class. Once in the...
0
3762
by: Carl Wright | last post by:
Hi I'm having this major issue loading a usercontrol at runtime using the overload on Loadcontrol(type,object). Here's the code in the aspx code-behind file Dim myControl As New Control Dim...
0
7040
marktang
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,...
0
6905
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...
0
7041
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,...
1
6736
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...
0
6908
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...
0
5331
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
2994
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2980
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
561
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.