hi
these are my table in database
HOuse_p Table
Id
|
Behcode
|
Name
|
H_name
|
Model
|
classification
|
1
|
1115
|
Iron
|
Electric |
Q2
|
Home
|
2
|
1113
|
Vacumcleaner
|
Electric
|
Cv21
|
Kitchen
|
3
|
1114
|
Carpet
|
furniture
|
Xs23
|
Home
|
4
|
1113
|
home
|
furniture
|
Df23
|
wood
|
and HOuse_menu Table
Id
|
H_name
|
Name
|
1
|
Electric
|
Iron
|
2
|
Furniture
|
Sofa
|
3
|
Kitchen
|
spon
|
in index.aspx and house.aspx i have menubar
when users click on item in index.aspx it go to house.aspx and datalist in house.aspx fill by product that users select from index .aspx and in house.aspx if users select ite from menu bar they can see product too
these are my code in index.aspx
<li class="current">
<a href="house.aspx?H_name=all">furniture</a>
<ul>
<asp:Repeater ID="rptMenu" runat="server">
<ItemTemplate>
<li><a href="house.aspx?H_name=<%#Eval("H_name") %>"><%#Eval("name") %></a> </li>
</ItemTemplate>
</asp:Repeater>
</ul>
</li>
BindRepeater(rptMenu, "Housemenu")
private void BindRepeater(Repeater RP, string spName)
{
SqlCommand _cmd = new SqlCommand(spName, _cn);
_cmd.CommandType = CommandType.StoredProcedure;
_cn.Open();
using (SqlDataAdapter sda = new SqlDataAdapter())
{
sda.SelectCommand = _cmd;
using (DataSet ds = new DataSet())
{
sda.Fill(ds);
RP.DataSource = ds;
RP.DataBind();
}
}
_cn.Close();
}
SP
ALTER procedure [dbo].[Housemenu]
as
begin
select name,H_name
from House_menu
end
and House.aspx
protected void Page_Load(object sender, EventArgs e)
{
BindRepeater(rptMenuE, "electricmenu");
if (!IsPostBack)
{
this.GetCustomersPageWise(1);
}
i class="current"><a href="house.aspx?H_name=Electric"></a>
<ul>
<asp:Repeater ID="rptMenuE" runat="server">
<ItemTemplate>
<li><a href="house.aspx?subset=<%#Eval("classification") %>">
<%#Eval("classification")%></a> </li>
</ItemTemplate>
</asp:Repeater>
</ul>
SP
ALTER procedure [dbo].[electricmenu]
as
begin
select distinct Classification,H_name
from House_p
where H_name='Electric'
end
and
private void GetCustomersPageWise(int pageIndex)
{
if (Request.QueryString["H_name"] != "all")
{
string BehCode = "";
using (SqlCommand cmd = new SqlCommand("GetCustomersPageWise1", _cn))
{
if (!(Request.QueryString["H_name"] == null))
{
BehCode = Request.QueryString["H_name"];
}
else if (!(Request.QueryString["subset"] == null))
{
BehCode = Request.QueryString["subset"];
}
//string BehCode = Request.QueryString["H_name"];
//string BehCode1 = Request.QueryString["subset"];
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@H_name", BehCode);
cmd.Parameters.AddWithValue("@subset", BehCode);
cmd.Parameters.AddWithValue("@Region", DDLzone1.SelectedItem.Value);
cmd.Parameters.AddWithValue("@district", ddldistric1.SelectedItem.Text.Trim());
cmd.Parameters.AddWithValue("@shoppingcenter", DDLstore1.SelectedItem.Text.Trim());
cmd.Parameters.AddWithValue("@PageIndex", pageIndex);
cmd.Parameters.AddWithValue("@PageSize", PageSize);
cmd.Parameters.Add("@RecordCount", SqlDbType.Int, 4);
cmd.Parameters["@RecordCount"].Direction = ParameterDirection.Output;
_cn.Open();
IDataReader idr = cmd.ExecuteReader();
DataList1.DataSource = idr;
DataList1.DataBind();
idr.Close();
_cn.Close();
int recordCount = Convert.ToInt32(cmd.Parameters["@RecordCount"].Value);
this.PopulatePager(recordCount, pageIndex);
}
}
else
{
using (SqlCommand cmd = new SqlCommand("GetCustomersPageWise", _cn))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@PageIndex", pageIndex);
cmd.Parameters.AddWithValue("@PageSize", PageSize);
cmd.Parameters.Add("@RecordCount", SqlDbType.Int, 4);
cmd.Parameters.AddWithValue("@Region", DDLzone1.SelectedItem.Value);
cmd.Parameters.AddWithValue("@district", ddldistric1.SelectedItem.Text.Trim());
cmd.Parameters.AddWithValue("@shoppingcenter", DDLstore1.SelectedItem.Text.Trim());
cmd.Parameters["@RecordCount"].Direction = ParameterDirection.Output;
_cn.Open();
IDataReader idr = cmd.ExecuteReader();
DataList1.DataSource = idr;
DataList1.DataBind();
idr.Close();
_cn.Close();
int recordCount = Convert.ToInt32(cmd.Parameters["@RecordCount"].Value);
this.PopulatePager(recordCount, pageIndex);
}
}
}
now in house.aspx page i have label
i want when users click item in index.aspx or click item from menubar in house.aspx (they bind from different table) in label show the name of item(related to users selected from index.aspx or house.aspx)
if they click item from index.aspx it show name column from House_menu tabel .
and if they click on menu bar item in house.aspx in label show classification column data from House_p table
can u help me?
best regards