Reg:Problem with Maintain Values in User Control
Reply
![]() |
|
|
From:
Programmer_Balaji
|
Hi All,
i am binding a UserControl in to Repeater. When i add new Row to the repeater again a usercontrol will be Loaded to the new Row at runtime. At this time the previous UserControl loses its values (The UserControl Contain some textboxes,dropdown Controls). I need to Retain the values in the userControl.Can any one help me to move ahead from this problem..
aspx ==== <asp:repeater id="rptJoinReqCommunityQ" runat="server" > <ItemTemplate>
|
<asp:Button ID="btnAdd" Text="Add" Runat="server"></asp:Button>
|
<asp:Repeater ID="rptCtrl" Runat="server" Visible="True"> <ItemTemplate>
<uc1:carrierprofileinformationaddl id="CarrierProfileInformationAddl1" runat="server" ></uc1:carrierprofileinformationaddl>
|
</ItemTemplate> </asp:Repeater>
|
</ItemTemplate> </asp:repeater>
aspx.cs -----------
Repeater rptCtrl = (Repeater)e.Item.FindControl("rptCtrl"); DataTable dtTable = new DataTable(); DataRow drTable; dtTable.Columns.Add("UserControl"); for(int i=0;i<rptCtrl.Items.Count;i++) { drTable = dtTable.NewRow(); drTable["UserControl"] = (UserControl) rptCtrl.Items[i].FindControl("CarrierProfileInformationAddl1"); dtTable.Rows.Add(drTable); } HtmlTableCell tb=new HtmlTableCell(); tb.Controls.Add(Page.LoadControl("/Prospective/CarrierProfileInformationAddl.ascx")); drTable = dtTable.NewRow(); drTable["UserControl"]=tb; dtTable.Rows.Add(drTable); rptCtrlDataSource = dtTable; rptCtrl.DataBind(); }
Cheers, Balaji
|
View other groups in this category.
![]() |
To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.
Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.
If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.
|
|