Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > loding dynamic user control giving error

Reply
Thread Tools

loding dynamic user control giving error

 
 
aammi@yahoo.com
Guest
Posts: n/a
 
      03-09-2007
I am tired of this error and now writing a post.

My Web application has two pages.

Page one has drop down list which redirect the page to another page . where I am going to load the usercontrol dynamically according to the choice of the user.



protected void ddlViewReport_SelectedIndexChanged(object sender, EventArgs e)

{

if (ddlViewReport.SelectedIndex == 1)

{

Session["ReportType"] = ddlViewReport.SelectedIndex;

Response.Redirect("RepReportingPage.aspx");

int crosspagevalue = ddlViewReport.SelectedIndex;

}

if (ddlViewReport.SelectedIndex == 2)

{

Session["ReportType"] = ddlViewReport.SelectedIndex;

Response.Redirect("RepReportingPage.aspx");







}
}



that code redirect me to the another page "RepRepoortingpage.aspx. There the user contol should load. It is loading but when I add the Textbox or the gridview, it throws and error. "Control 'ctl02_GridView1' of type 'GridView' must be placed inside a form tag with runat=server"

I tried many things but it still not working. here is the code for the other page where I am loading the control dynamically.



public partial class RepReportingPage : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{





int whichControl = Convert.ToInt32(Session["ReportType"]);

if (whichControl == 1)

{

Control UCReportExpense = LoadControl("WebUserControl2.ascx");

PlaceHolder1.Controls.Add(UCReportExpense);



}

else

{

Response.Write("would put seocond user control after solving the problem");

}



}

}



Now any help here please .
 
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
mysql loding error Sushrut Sathe Ruby 1 05-27-2009 10:48 PM
The giving that keeps on giving sixteenmillion C Programming 0 11-19-2007 10:59 PM
loding dynamic user control giving error aammi@yahoo.com ASP .Net Web Controls 1 03-12-2007 09:14 AM
Giving dynamic value to data control attribute יוני גולדברג ASP .Net Web Controls 0 09-03-2006 09:40 AM
Crash in CreateJavaVM after loding libjvm.so(jre1.4) from C app dynamically... kiran.dpatil@gmail.com Java 0 04-22-2005 09:38 AM



Advertisments