Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to persist 'doubled up' usercontrol in a datalist and a repeater control across a postback - arghhh!

How to persist 'doubled up' usercontrol in a datalist and a repeater control across a postback - arghhh!

Scheduled Pinned Locked Moved ASP.NET
sysadmintutorialquestionannouncement
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fu Manchu
    wrote on last edited by
    #1

    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

    N 1 Reply Last reply
    0
    • F Fu Manchu

      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

      N Offline
      N Offline
      Nishant Singh
      wrote on last edited by
      #2

      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

      N 1 Reply Last reply
      0
      • N Nishant Singh

        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

        N Offline
        N Offline
        Nishant Singh
        wrote on last edited by
        #3

        In this case check whether on Page load(After Postback) the conrols are rendered .........

        F 1 Reply Last reply
        0
        • N Nishant Singh

          In this case check whether on Page load(After Postback) the conrols are rendered .........

          F Offline
          F Offline
          Fu Manchu
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups