Click here to Skip to main content
11,645,087 members (65,090 online)
Rate this: bad
good
Please Sign up or sign in to vote.
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 16-Sep-12 19:02pm
Edited 16-Sep-12 19:18pm
v3
Comments
Sangramsingh Pawar at 17-Sep-12 1:14am
   
I don't get what is your problem
explain more clearly your problem
Rashid Choudhary at 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..
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.

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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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
  Permalink  
Comments
Kenneth Haugland at 21-Sep-12 16:34pm
   
WHats the meaning of this, its just a repost of the first solution.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

if u want to bind data with grid according to dropdown selected index changed then u should try this
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
  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 700
1 jyo.net 494
2 Sergey Alexandrovich Kryukov 449
3 Afzaal Ahmad Zeeshan 444
4 CPallini 386
0 OriginalGriff 1,065
1 Sergey Alexandrovich Kryukov 683
2 DamithSL 681
3 Afzaal Ahmad Zeeshan 662
4 CPallini 555


Advertise | Privacy | Mobile
Web04 | 2.8.150731.1 | Last Updated 25 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100