Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
i mean is there any simple way i may do it but sure it will reduce performance drastically, help please;

 List<object> CategoryIdRaw = new List<object>();
            List<string> categoryId = new List<string>();

            DataTable dt = ds.Tables[0];
            foreach (DataRow row in dt.Rows)
            {
                foreach (DataColumn col in dt.Columns)
                {
                    CategoryIdRaw.Add(row[col]);
                }
               
            }
            for (int i = 0; i < CategoryIdRaw.Count; i++)
            {
                categoryId.Add(Convert.ToString(CategoryIdRaw[i]));
                i = i + 2;
            }
            /////////////////////////////////////////////

            DataSet ds2 = new DataSet();
            for (int i = 0; i < categoryId.Count; i++)
            {
                string Qbanner = "SELECT [BannerId],[BannerName],[Image1],[ExpiryDate],[Discount],[Offer],[BeautyServices],[TermsCondition],[Status],[CityId],[StateId],[Address],[Remarks],[CategoryId],[UserId],[Bdate] FROM [Groupon].[dbo].[Banner] where CategoryId=" + categoryId[i];
                ds2 = conn.FillDataSet(CommandType.Text, Qbanner);
                GridView1.DataSource = ds2;
                GridView1.DataBind(); 
            }

i was trying something like that;
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


<pre><Columns><asp:TemplateField><ItemTemplate>
    <div class="deal_sec">
      <p class="deal_txt1">Valid upto:&nbsp;&nbsp;<span><asp:Literal ID="LexDate" Mode="Transform" Text='<%# Eval("ExpiryDate") %>' runat="server"></asp:Literal></span></p>
      <p class="deal_txt2">
       <asp:Literal ID="Laddress" Text='<%# Eval("Address") %>' Mode="Transform" runat="server"></asp:Literal>
       </p>
      <%--<img src="images/spa_img1.jpg" alt="" title="" />--%>
      <asp:Image CommandArgument='<%# Eval("BannerId") %>' Height="155px" Width="299px" ImageUrl='<%# "~/Handler2.ashx?id="+Eval("BannerId")  %>' ID="Image1" runat="server" />
      <p  class="deal_txt3">rem ipsum dolor</p>
      <p class="deal_txt4">
          <asp:Literal ID="LtAndC" Mode="Transform" Text='<%# Eval("TermsCondition") %>' runat="server"></asp:Literal></p>
    </div>

    <div class="deal_sec deal_gap">
      <p id="pValidity2" runat="server"  title='<%# Eval("ExpiryDate") %>' class="deal_txt1">Valid upto:&nbsp;&nbsp;<span>31-Aug-2013</span></p>
      <p id="pLocation2" runat="server" title='<%# Eval("Address") %>' class="deal_txt2">Lorem ipsum dolor </p>
      <%--<img src="images/spa_img2.jpg" alt="" title="" />--%>
      <asp:Image CommandArgument='<%# Eval("BannerId") %>' Height="155px" Width="299px" ImageUrl='<%# "~/Handler2.ashx?id="+Eval("BannerId")  %>' ID="Image2" runat="server" />
      <p class="deal_txt3">Lorem ipsum dolor</p>
      <p id="pDescription2" runat="server" title='<%# Eval("TermsCondition") %>' class="deal_txt4">Lorem ipsum dolor sit amet, consectetur adipis
cing elit. Quisque porttitor</p>
    </div>
    
    <div class="deal_sec deal_gap">
      <p id="pValidity3" runat="server" title='<%# Eval("ExpiryDate") %>' class="deal_txt1">Valid upto:&nbsp;&nbsp;<span>31-Aug-2013</span></p>
      <p id="pLocation3" runat="server" title='<%# Eval("Address") %>' class="deal_txt2">Lorem ipsum dolor </p>
      <%--<img src="images/spa_img3.jpg" alt="" title="" />--%>
      <asp:Image CommandArgument='<%# Eval("BannerId") %>' Height="155px" Width="299px" ImageUrl='<%# "~/Handler2.ashx?id="+Eval("BannerId")  %>' ID="Image3" runat="server" />
      <p  class="deal_txt3">Lorem ipsum dolor</p>
      <p id="pDescription3" runat="server" title='<%# Eval("TermsCondition") %>' class="deal_txt4">Lorem ipsum dolor sit amet, consectetur adipis
cing elit. Quisque porttitor</p>
    </div>
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
Posted
Updated 8-Sep-13 6:58am
v3
Comments
[no name] 8-Sep-13 11:38am    
How would you expect us to know? I do not see a single label, gridview, row, table or anything else you mentioned in any of the code that you posted that you say you are having some sort of trouble with.
Sergey Alexandrovich Kryukov 8-Sep-13 11:47am    
What's the problem? http://whathaveyoutried.com so far?
—SA
varun150 8-Sep-13 12:38pm    
lolz i thought u'd give me some general idea , atleast u'd tell it even possible or not but okk i understand you
varun150 8-Sep-13 12:41pm    
lolz .....i thought u'd give me some general idea at least whether it was possible or not. but okk i try to put some code here
Sergey Alexandrovich Kryukov 8-Sep-13 15:03pm    
Of course it's possible. The general idea? Apply separation of concerns: database is one thing, UI is another one. In many controls, it's the best to use available binding, but as you managed to create several unrelated labels (why, by the way? wouldn't it be better to review your UI design to make it more regular and "bindable"? I don't say you must though, it depends...), you should fetch data separately, and assign values to correspondent Label.Text properties separately.
—SA

1 solution

i found some other way to do it, thank you so much for your try;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900