TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sulakshana Manavalan
NA
1
0
WebParts
Jul 31 2007 3:23 AM
Hi All, I m new to this forum. i m working on web parts now. Please help me out... I am loading user controls referred from DB for each user as per requirement. i m able to add the controls , but i m not able to personalize these dynamically added contents. I tried doing with catalog manager but i want to display the usercontrols for a particular user from DB in Pageload itself. if i use catalog manager, the user shud select the usercontrols. this is the code which i have tried: dsusercntrl is the dataset refering to my usercontrol path AddControlsZone is the zone in my aspx page. if (dsusercntrl.Tables[0].Rows.Count != 0) { for (int i = 0; i < dsusercntrl.Tables[0].Rows.Count; i++) { string strUserControlPath = dsusercntrl.Tables[0].Rows[i]["UserControlPath"].ToString(); Control ucdet = this.LoadControl(strUserControlPath); ucdet.ID = dsusercntrl.Tables[0].Rows[i]["UseControlName"].ToString(); string[] str = strUserControlPath.Split('/'); int inturlcount = str.Length; string strcntrlname = str[inturlcount - 1]; strcntrlname = "controls_" + strcntrlname.Replace('.', '_').ToLower(); if (AddControlsZone.WebParts.Count > 0) { WebPart webccontrol = AddControlsZone.WebParts[0]; //int intwebcount = AddControlsZone.WebParts.Count; //int intcntrlcount = AddControlsZone.Controls.Count; if (dsusercntrl.Tables[0].Rows.Count == AddControlsZone.WebParts.Count) { HttpCookie cookEmail = new HttpCookie("Email", EmailID); Response.Cookies.Remove("Email"); Response.Cookies.Add(cookEmail); HttpCookie cookPass = new HttpCookie("Pass", Password); Response.Cookies.Remove("Pass"); Response.Cookies.Add(cookPass); Response.Cookies["Email"].Expires = DateTime.Now.AddDays(15); Response.Cookies["Pass"].Expires = DateTime.Now.AddDays(15); } else { GenericWebPart wpdet = WebPartmngr.CreateWebPart(ucdet); wpdet.Title = dsusercntrl.Tables[0].Rows[i]["UseControlName"].ToString(); WebPartmngr.AddWebPart(wpdet, AddControlsZone, 1); } } else { GenericWebPart wpdet = WebPartmngr.CreateWebPart(ucdet); wpdet.Title = dsusercntrl.Tables[0].Rows[i]["UseControlName"].ToString(); WebPartmngr.AddWebPart(wpdet, AddControlsZone, 1); } } } }
Reply
Answers (
0
)
asp.net POST method
Updating Gridview Control