在网格视图中显示下拉列表值 [英] to display dropdown lists value in grid view

查看:60
本文介绍了在网格视图中显示下拉列表值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是asp.net的新手.
我在上方选择了一个下拉列表,在下方选择了gridview.
如果我在客户ID的下拉列表中选择特定值,则应在gridview中显示客户详细信息.
请尽快帮助我.

i am new to asp.net.
i have taken a dropdownlist above and gridview below.
if i select the particular value in dropdown list of customer id it should display the customer details in gridview.
plese help me ASAP.

推荐答案

确保在aspx中将DropDownList的AutoPostBack属性设置为True


make sure you set AutoPostBack Property of DropDownList to True in aspx


<asp:dropdownlist id="ddlCompany" runat="server" onselectedindexchanged="ddlCompany_SelectedIndexChanged" autopostback="true" xmlns:asp="#unknown" /> 


以下是您背后的代码中的事件处理程序



the below is your event handler in code behind


protected void ddlCompany_SelectedIndexChanged(object sender, EventArgs e)
{
   string strCompID = ddlCompany.SelectedValue.ToString();
   //bind here your GridView's data bsed on the selected ID strCompID.
}



如果解决您的问题,则标记为答案.



mark as answer if solves your problem.


您好,
下拉列表到Gridview [
Hi,
Dropdownlist to Gridview[^]


这篇关于在网格视图中显示下拉列表值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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