下拉列表选择不可能自动收缩 [英] dropdownlist selection not possible it shrinks automatically
问题描述
我在更新面板中放置了一个下拉列表
I placed an dropdown list in an update panel
asp:UpdatePanel ID="UpdatePanel3" runat="server">
<contenttemplate>
<asp:DropDownList ID="DropDownList1" runat="server" Height="24px"
Width="186px">
</contenttemplate>
</asp:UpdatePanel>
和formload我这样写的
and in formload i write like this
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
connStr = ConfigurationManager.ConnectionStrings["NFTRANSConnectionString1"].ConnectionString;
Driverjobcodeload();
}
}
public void Driverjobcodeload()
{
DataTable dt = new DataTable();
SqlConnection con = new SqlConnection(connStr);
SqlDataReader ddDR = null;
con.Open();
SqlCommand cmd = new SqlCommand("Select DriverCode ,Driverid from DriverMaster_tbl ", con);
ddDR = cmd.ExecuteReader();
dt.Load(ddDR);
DropDownList1.DataSource = dt;
DropDownList1.DataTextField = "DriverCode";
DropDownList1.DataValueField = "Driverid";
DropDownList1.DataBind();
}
但是当我在浏览器Iam无法在下拉列表中选择任何项目,一旦我展开列表,它会在一秒钟内自动缩小,即使我设法选择一个它不会是所选项目,所选项目将默认为第一个。
我知道,因为我是一个新的bie到web开发它可能是我身边的错误但是任何人都可以建议任何可能的问题
but when i run this in browser Iam not able to select any item in the dropdownlist once i expan the list it get shrinked automatically within a second and even if i manage to select one its willnot be the selected item selected item will be default the first one.
I know since iam a new bie to web development it may be a error from my side but can anyone suggest any possible issue
推荐答案
Here's jQuery based example. it takes all keyboard and mouse events into account, especially clicks:
if (!
.support.leadingWhitespace){// if IE6 / 7/8
.support.leadingWhitespace) { // if IE6/7/8
('select.wide')
.bind('focus mouseover',function(){
('select.wide') .bind('focus mouseover', function() {
这篇关于下拉列表选择不可能自动收缩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!