HI
HI
i have 2 page
1-index.aspx
2-state .aspx
when users click on menubar in index.aspx they go to state.aspx
in State.aspx is gridview with 6 Dropdownlist that occording to their selected item from DDL they can see result in gridview
now my problem is :
when i click item from menubar in index.aspx when it go to state.aspx it doesn't show any thing in gridview.
i want at first when users go to state.aspx page they can see all data in gridview after that they select item from DDL and see result according to their selected item
SP
ALTER procedure [dbo].[ViewEstate1]
@Type nvarchar(20)
,@Transfer nvarchar(20)
,@measure varchar(20)
,@Zone nvarchar(50)
,@City nvarchar(20)
,@District nvarchar(30)
as
begin
select id,Transfer,Type,Measure,price,zone,date,District,substring([address],0,18)+'...' as address
from Estate_p
where (Type=@Type or @Type='همه') and (Transfer=@Transfer or @Transfer='all') and (Measure=@measure or @measure='all') and (City=@City or @City='all') and (zone=@Zone or zone='all') and (District=@District or @District='all')
order by date
end
behind code
private void BindData()
{
SqlCommand cmd = new SqlCommand("ViewEstate1", _cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Type", ddltype.SelectedItem.Text);
cmd.Parameters.AddWithValue("@Transfer", ddlTran.SelectedItem.Text.Trim());
cmd.Parameters.AddWithValue("@measure", ddlmeter.SelectedItem.Text.Trim());
cmd.Parameters.AddWithValue("@City", DDLcity1.SelectedItem.Text.Trim());
cmd.Parameters.AddWithValue("@Zone", DDLzone1.SelectedItem.Text.Trim());
cmd.Parameters.AddWithValue("@District", ddldistric1.SelectedItem.Text.Trim());
GridView2.DataSource = GetData(cmd);
GridView2.DataBind();
}
Thanks alot