Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Dynamically Loading User Controls

Reply
Thread Tools

Dynamically Loading User Controls

 
 
Rick Mavrovik
Guest
Posts: n/a
 
      08-29-2007
Hi,
I am trying to generate a number of Web User Controls (WUC) based on user
input.

This WUC has got 2 drop down controls in it. The WUC works fine when created
in the usual manner but when I try to create it dynamically a null reference
exception is thrown when trying to refering any of the drop down.

UCUserToDeviceInBulk ucTemp = new UCUserToDeviceInBulk();
ucTemp.Visible = true;
ucTemp.LoadData(Convert.ToInt32(ddlClient.Selected Item.Value));
Inside the LoadDate when I try to use the any of the drop down list.. a null
reference exception occurs

public void LoadData(int clientID){
ddlUser.CssClass = "GAMADdlNormal";
}

Does anyone have any clue why this is happening.

Thanks

-Rick


 
Reply With Quote
 
 
 
 
=?Utf-8?B?TGFkaXNsYXYgTXJua2E=?=
Guest
Posts: n/a
 
      08-29-2007
Hi Rick,
when do you create your WUCs?

Regards,
Ladislav

"Rick Mavrovik" wrote:

> Hi,
> I am trying to generate a number of Web User Controls (WUC) based on user
> input.
>
> This WUC has got 2 drop down controls in it. The WUC works fine when created
> in the usual manner but when I try to create it dynamically a null reference
> exception is thrown when trying to refering any of the drop down.
>
> UCUserToDeviceInBulk ucTemp = new UCUserToDeviceInBulk();
> ucTemp.Visible = true;
> ucTemp.LoadData(Convert.ToInt32(ddlClient.Selected Item.Value));
> Inside the LoadDate when I try to use the any of the drop down list.. a null
> reference exception occurs
>
> public void LoadData(int clientID){
> ddlUser.CssClass = "GAMADdlNormal";
> }
>
> Does anyone have any clue why this is happening.
>
> Thanks
>
> -Rick
>
>
>

 
Reply With Quote
 
 
 
 
Rick Mavrovik
Guest
Posts: n/a
 
      08-29-2007
I create the WUCs in button click event.
The creation of the WUC goes ahead fine. the line below doest not cause the
error
UCUserToDeviceInBulk ucTemp = new UCUserToDeviceInBulk();

-Sami

"Ladislav Mrnka" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Rick,
> when do you create your WUCs?
>
> Regards,
> Ladislav
>
> "Rick Mavrovik" wrote:
>
>> Hi,
>> I am trying to generate a number of Web User Controls (WUC) based on user
>> input.
>>
>> This WUC has got 2 drop down controls in it. The WUC works fine when
>> created
>> in the usual manner but when I try to create it dynamically a null
>> reference
>> exception is thrown when trying to refering any of the drop down.
>>
>> UCUserToDeviceInBulk ucTemp = new UCUserToDeviceInBulk();
>> ucTemp.Visible = true;
>> ucTemp.LoadData(Convert.ToInt32(ddlClient.Selected Item.Value));
>> Inside the LoadDate when I try to use the any of the drop down list.. a
>> null
>> reference exception occurs
>>
>> public void LoadData(int clientID){
>> ddlUser.CssClass = "GAMADdlNormal";
>> }
>>
>> Does anyone have any clue why this is happening.
>>
>> Thanks
>>
>> -Rick
>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Issues in ASP.NET 2.0 when dynamically loading user controls or asp.net web controls??? Bob Rock ASP .Net 1 09-17-2006 01:49 PM
Dynamically Loaded controls loading other controls =?Utf-8?B?V291dGVy?= ASP .Net 3 02-27-2006 07:25 PM
loading user controls dynamically Nick Stansbury ASP .Net 1 07-19-2004 12:38 PM
when loading user controls dynamically, problem on postback sonic_soul ASP .Net 0 08-14-2003 10:05 PM
Re: Loading/Unloading web user controls dynamically in code - Does this look right? Ben Miller [msft] ASP .Net 0 08-05-2003 05:57 AM



Advertisments