我想在下拉列表中选定索引更改的下拉列表中选择的项目中,在gridview中显示该项目 [英] i want to display the item in gridview with the item selected in dropdownlist on selected index change of dropdownlist

查看:108
本文介绍了我想在下拉列表中选定索引更改的下拉列表中选择的项目中,在gridview中显示该项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在第两个或更多列中放置了hv drpdwnlst...当我选择任何列名时,相关数据将显示在网格视图中. t .......... thanxxx advance

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

推荐答案



根据您所提出的问题,我理解的是,您希望根据下拉列表中的值显示数据.如果正确,那么下面的代码可能对您有用,

您可以创建一个StoredProcedure,它可以接受输入作为下拉列表的值.

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.


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


如果您要根据更改的下拉列表索引将数据与网格绑定,则应尝试使用此
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


这篇关于我想在下拉列表中选定索引更改的下拉列表中选择的项目中,在gridview中显示该项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆