How to persist 'doubled up' usercontrol in a datalist and a repeater control across a postback - arghhh!
-
Hi guys, I don't know which way to go with this i think ive exhausted all efforts. My usercontrol display information but when i click update a full page postback occurs and i lose everything, my control disappears! I have an extremely large amount of data to display to the users, so using exsiting controls like a gridview is just silly. I've opted for a usercontrol that displays a set of prices by location and product. I have also given the user a couple of checkbox controls to be able to select groups of locations and groups of products. Ive put my usercontrol in another with a datalist and a objectdatasource that gets a list of the locations and this accepts a productID, this is why im saying 'doubled up'. A usercontrol within a usercontrol! Not sure if this is the best solution? Because i cant directly access the control with a datalist? On the main form, i have a repeater control with the usercontrol inside it. This repeats the locations selected (9 max) (created by the datalist) for every product (33 max) selected if you get me! Each control has an update button, but when its clicked the controls disappear. Listed below is the second control:-
<asp:DataList ID="DataList1" runat="server" RepeatColumns="3" DataSourceID="ObjectDataSource1"> <ItemTemplate> <uc1:CompanyPriceWidget ID="CompanyPriceWidget" runat="server" companyName='<%#Eval("Company.CompanyName")%>' productCost='<%#Eval("StockItemProductCostSterling")%>' retailSalePrice='<%#Eval("StockItemRetailSalePriceSterling")%>' productCostOverHead= '<%#Eval("StockItemProductCostOverHead")%>' retailSalePriceOverHead='<%#Eval("StockItemRetailSalePriceOverHead")%>' ExchangeRate='<%#Eval("Company.CurrencyExchangeRate.CurrencyRate")%>' companyId='<%#Eval("Company.CompanyID")%>' OnUpdateValues="CompanyPriceWidget_UpdateValues" /> </ItemTemplate> </asp:DataList> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetListOfStockValueGroupedByCompany" TypeName="StockValueSterlingDel" OldValuesParameterFormatString="original_{0}"> <SelectParameters> <asp:Parameter Name="stockItemPriceBandId" Type="Int32" /> </SelectParameters> </asp:ObjectDataSource>
On the Main Form<asp:Re
-
Hi guys, I don't know which way to go with this i think ive exhausted all efforts. My usercontrol display information but when i click update a full page postback occurs and i lose everything, my control disappears! I have an extremely large amount of data to display to the users, so using exsiting controls like a gridview is just silly. I've opted for a usercontrol that displays a set of prices by location and product. I have also given the user a couple of checkbox controls to be able to select groups of locations and groups of products. Ive put my usercontrol in another with a datalist and a objectdatasource that gets a list of the locations and this accepts a productID, this is why im saying 'doubled up'. A usercontrol within a usercontrol! Not sure if this is the best solution? Because i cant directly access the control with a datalist? On the main form, i have a repeater control with the usercontrol inside it. This repeats the locations selected (9 max) (created by the datalist) for every product (33 max) selected if you get me! Each control has an update button, but when its clicked the controls disappear. Listed below is the second control:-
<asp:DataList ID="DataList1" runat="server" RepeatColumns="3" DataSourceID="ObjectDataSource1"> <ItemTemplate> <uc1:CompanyPriceWidget ID="CompanyPriceWidget" runat="server" companyName='<%#Eval("Company.CompanyName")%>' productCost='<%#Eval("StockItemProductCostSterling")%>' retailSalePrice='<%#Eval("StockItemRetailSalePriceSterling")%>' productCostOverHead= '<%#Eval("StockItemProductCostOverHead")%>' retailSalePriceOverHead='<%#Eval("StockItemRetailSalePriceOverHead")%>' ExchangeRate='<%#Eval("Company.CurrencyExchangeRate.CurrencyRate")%>' companyId='<%#Eval("Company.CompanyID")%>' OnUpdateValues="CompanyPriceWidget_UpdateValues" /> </ItemTemplate> </asp:DataList> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetListOfStockValueGroupedByCompany" TypeName="StockValueSterlingDel" OldValuesParameterFormatString="original_{0}"> <SelectParameters> <asp:Parameter Name="stockItemPriceBandId" Type="Int32" /> </SelectParameters> </asp:ObjectDataSource>
On the Main Form<asp:Re
So as I can make out .... There are 2 Different User Controls one in dataList and other in Repeater control ....... and the problem which you are facing is that on postback the UserControl inside the repeater disappears
-
So as I can make out .... There are 2 Different User Controls one in dataList and other in Repeater control ....... and the problem which you are facing is that on postback the UserControl inside the repeater disappears
In this case check whether on Page load(After Postback) the conrols are rendered .........
-
In this case check whether on Page load(After Postback) the conrols are rendered .........
Thanks for your reply, I have a render event in my control that fires to fill up the textboxes etc... You have given my an idea to why this is happening, it appears that the value thats in passed to the first control is now 0 at postback, i'll have to create some kind of collection to store these in session. However when i fix this value, the controls a rendered but i now lose all my data as everything goes to 0. So is appears that all the data in the controls is lost due to the postback. this is going to be one almighty collection stored in session, the viewstate is going to be massive! Thanks for your help Andy