Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i hv drpdwnlst.in lst two or more colum is placed..when i select any column name then the related data is shown in grid view..
t..........thanxxx an advance
Posted
Updated 16-Sep-12 19:18pm
v3
Comments
Sangramsingh Pawar 17-Sep-12 1:14am    
I don't get what is your problem
explain more clearly your problem
Rashid Choudhary 17-Sep-12 1:17am    
i hv drpdwnlst.in lst two or more colum is placed..when i select any column name then the related data is shown in grid view..

Hi,

From your encypted question what i understand is, you want to show your data depending on the value in the dropdownlist. If it is correct then below code may work for you,

You can create one StoredProcedure that can accept inputs as the value of your dropdownlist.

SQL
CREATE PROCEDURE selectDataByDDLValue(@ddlValue INTEGER)
AS
IF @ddlValue == 1
BEGIN
-- Query3 to execute
END
ELSE
BEGIN
  IF @ddlValue == 2
  BEGIN
  -- Query2 to execute
  END
  ELSE
  BEGIN
  -- Query3 to execute
  END
END
GO

Hope you got the idea.
 
Share this answer
 
SQL
CREATE PROCEDURE selectDataByDDLValue(@ddlValue INTEGER)
AS
IF @ddlValue == 1
BEGIN
-- Query3 to execute
END
ELSE
BEGIN
  IF @ddlValue == 2
  BEGIN
  -- Query2 to execute
  END
  ELSE
  BEGIN
  -- Query3 to execute
  END
END
GO
 
Share this answer
 
Comments
Kenneth Haugland 21-Sep-12 16:34pm    
WHats the meaning of this, its just a repost of the first solution.
if u want to bind data with grid according to dropdown selected index changed then u should try this
C#
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
  {
// get selected value of dropdown.
      int intValue= int.Parse(ddlCompany.SelectedValue.ToString());
// call function for displaying records in grid according to dropdown value 
      fnShowDetails(intValue);
  }

protected void fnShowDetails(int intReference)
  {
       // here u should send value(intReference) to database for getting record and bind the grid with returning  datatable or dataset .
  }


Hope this will help u.
Thanks
 
Share this answer
 
v2

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