Click here to Skip to main content
16,016,477 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have created 2 datalist 1'st is catalogue & 2'nd is cat_detail

now my que is in catalogue i select pizza in 2'nd datalist which is cat_detail i want only pizza records

in detail
C#
catalogue tbl=cat_id,cat_nm for ex:1,pizza
2,pasta
cat_detail tbl=id,cat_id,name,type,price,des. 
for ex:1,1,margherita pizza,veg,200,abc.
2,1,mashroom riot,veg,200,xyz
3,2,italian pasta,veg,150,pqr


code is like that..
catalogue.aspx

XML
<asp:DataList ID="DataList2" runat="server" DataKeyField="cat_id"
           RepeatColumns="1"  BackColor="White"
           BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px"
          CellPadding="10" Font-Bold="True" Font-Italic="True" Font-Size="X-Large"
          Font-Underline="True" ForeColor="Black" ItemStyle-BorderColor="#FF9933"
          ItemStyle-Font-Bold="True" ItemStyle-ForeColor="#FF9933"
          SelectedItemStyle-ForeColor="White" SelectedItemStyle-BackColor="#FF9933"
          GridLines="Horizontal" onselectedindexchanged="DataList2_SelectedIndexChanged">

         <ItemTemplate>
             <asp:LinkButton ID="LinkButton1" runat="server"  onclick="LinkButton1_Click" Text='<%#Bind("cat_nm") %>' CausesValidation="True">LinkButton</asp:LinkButton>
          <!--<asp:Label ID="lbl_catalogue_name" runat="server"></asp:Label><br />-->

      </ItemTemplate>
       </asp:DataList>
    </div>
  </div></td>

 <td>
 <div class="right-content1"><center>
  <div class="title2"><center> your menu..</center></div>
  <div id="#right-content">
      <asp:ValidationSummary ID="ValidationSummary1" runat="server"
          ShowMessageBox="True" ShowSummary="False" />


      <asp:DataList ID="DataList1" runat="server" DataKeyField="id"
           RepeatColumns="3"  BackColor="White"
           BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3"
           GridLines="Horizontal"
          onselectedindexchanged="DataList1_SelectedIndexChanged">

         <ItemTemplate>
             Catalogue Name:
          <asp:Label ID="idLabel" runat="server" Text='<%# Eval("name") %>'></asp:Label><br />
             Type:
          <asp:Label ID="cat_idLabel" runat="server" Text='<%# Eval("type") %>'></asp:Label><br />
          <asp:Image ID="Image1" runat="server" ImageUrl='<%#Bind("image")%>' Height="200px" Width="200px"/><br />
             Price:
          <asp:Label ID="typeLabel" runat="server" Text='<%# Eval("price") %>'></asp:Label>

          <asp:ImageButton ID="ImageButton1" onclick="ImageButton1_Click" runat="server" ImageUrl="images/saddtocart2.gif" height="30px" width="80px" align="right"/>
                 <h4><a href="detail.aspx?id=<%# Eval("id") %>" >More</a></h4>
                <br /><br />
      </ItemTemplate>
       </asp:DataList>



catalogue.aspx.cs

C#
protected void Page_Load(object sender, EventArgs e)
    {
        connection c1 = new connection();    
        DataList2.DataSource=c1.selval("select * from catalogue");
        DataList2.DataBind();
        
        
    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        
        Response.Redirect("shippingcart.aspx");
    }

    protected void DataList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        
    }
    protected void DataList2_SelectedIndexChanged(object sender, EventArgs e)
    {
       
    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        
        SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True");
        SqlDataAdapter sda = new SqlDataAdapter("select * from cat_detail where cat_id=1", con);
        DataSet ds = new DataSet();
        sda.Fill(ds);
        DataList1.DataSource = ds;
        DataList1.DataBind();
    }


from this code i get only pizza detail not pasta or other cataloguemenu
Posted
Updated 28-Feb-14 19:06pm
v2
Comments
Member 10627896 1-Mar-14 7:12am    
plz TEJAS VAISHNAV sir plz tell me

what you change in this que?????

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