下拉列表 [英] Dropdownlist

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

问题描述




我有一个下拉列表,其中应该包含来自

数据库的多个值,我用de page_load()填充它代码:

如果不是Page.IsPostBack那么


InlezenConfig()


Dim strsqlDocType As String ="选择不同的类型来自

TBL_Bestanden_Zoeken"


Dim da As New SqlClient.SqlDataAdapter(strsqlDocType,connectie)


试试


connectie.Open()


da.Fill(ds," doctype")


ddlDocType.DataSource = ds.Tables(" doctype")

ddlDocType.DataBind()


Catch ex As Exception < br $>

最后


connectie.Close()


ddlDocType.Items.Insert(0," ; Selecteer een type)


ddlDocType.SelectedIndex = 0


结束尝试


结束如果


lblZoeken.Visible = False


dtgZoekResultaten.Visible = True


该代码还添加了一个标准值,''Selecteer een type''应该是

在开头添加名单。现在的问题是,当我启动我的

应用程序时,只有值''Selecteer uw type''在下拉列表中,但是

数据库中的其他值也应该在其中。我该怎么办?

这个???

$ b $bFré

Hi,

I have a dropdownlist that contains should contain several values from the
database, I fill it up in de page_load() with this code:
If Not Page.IsPostBack Then

InlezenConfig()

Dim strsqlDocType As String = "select distinct type from
TBL_Bestanden_Zoeken"

Dim da As New SqlClient.SqlDataAdapter(strsqlDocType, connectie)

Try

connectie.Open()

da.Fill(ds, "doctype")

ddlDocType.DataSource = ds.Tables("doctype")

ddlDocType.DataBind()

Catch ex As Exception

Finally

connectie.Close()

ddlDocType.Items.Insert(0, "Selecteer een type")

ddlDocType.SelectedIndex = 0

End Try

End If

lblZoeken.Visible = False

dtgZoekResultaten.Visible = True

The code also adds a standard value, ''Selecteer een type'' that should be
added at the beginning of the list. The problem now is that when i start my
application only the value ''Selecteer uw type'' is in the dropdownlist, but
the other values from the database should also be in it. How can i fix
this???

Fré

推荐答案

你可以在数据集(表格)中添加标准值(Selecteer een类型)
带有Rows.InsertAt的
可能然后数据绑定下拉列表吗?


Frederik Vanderhaeghe < FR ****************** @ gmail.com>在消息中写道

news:uO ************** @ TK2MSFTNGP05.phx.gbl ...
Can you add the standard value (Selecteer een type) in the dataset(table)
with Rows.InsertAt maybe and then databind the dropdown?

"Frederik Vanderhaeghe" <fr******************@gmail.com> wrote in message
news:uO**************@TK2MSFTNGP05.phx.gbl...

我有一个包含应该包含来自
数据库的多个值的下拉列表,我用de code_load()填写这段代码:
如果不是Page.IsPostBack那么

InlezenConfig()

Dim strsqlDocType As String =" select distinct type from
TBL_Bestanden_Zoeken"

Dim da As New SqlClient.SqlDataAdapter(strsqlDocType,尝试

connectie.Open()

da.Fill(ds," doctype") > ddlDocType.DataSource = ds.Tables(" doctype")

ddlDocType.DataBind()

Catch ex As Exception

最后

connectie.Close()

ddlDocType.Items.Insert(0," Selecteer een type")

ddlDocType.SelectedIndex = 0
结束尝试

结束如果

lblZoeken.Visible = False

dtgZoekResultaten。 Visible = True

代码还添加了一个标准值,''Selecteer een type''应该在列表的开头添加。现在的问题是,当我启动我的
应用程序时,只有值''Selecteer uw type''在下拉列表中,但是数据库中的其他值也应该在其中。我怎么能解决这个问题呢?

Fré
Hi,

I have a dropdownlist that contains should contain several values from the
database, I fill it up in de page_load() with this code:
If Not Page.IsPostBack Then

InlezenConfig()

Dim strsqlDocType As String = "select distinct type from
TBL_Bestanden_Zoeken"

Dim da As New SqlClient.SqlDataAdapter(strsqlDocType, connectie)

Try

connectie.Open()

da.Fill(ds, "doctype")

ddlDocType.DataSource = ds.Tables("doctype")

ddlDocType.DataBind()

Catch ex As Exception

Finally

connectie.Close()

ddlDocType.Items.Insert(0, "Selecteer een type")

ddlDocType.SelectedIndex = 0

End Try

End If

lblZoeken.Visible = False

dtgZoekResultaten.Visible = True

The code also adds a standard value, ''Selecteer een type'' that should be
added at the beginning of the list. The problem now is that when i start
my
application only the value ''Selecteer uw type'' is in the dropdownlist, but
the other values from the database should also be in it. How can i fix
this???

Fré



也许是因为你的代码说:

ddlDocType.SelectedIndex = 0

????

" Frederik Vanderhaeghe" < FR ****************** @ gmail.com>在消息中写道

news:uR ************** @ TK2MSFTNGP05.phx.gbl ...
Maybe because your code says:
ddlDocType.SelectedIndex = 0
????
"Frederik Vanderhaeghe" <fr******************@gmail.com> wrote in message
news:uR**************@TK2MSFTNGP05.phx.gbl...
我已经解决了这个问题,但我有另一个:-(

当我从下拉列表中选择一个项目时,我按下搜索,
所选项目将更改为第一个索引。如何解决此问题?

Pipo< Pa **** @ Mayo.com>在留言中写道
新闻:%2 ******* ********* @ TK2MSFTNGP05.phx.gbl ...
I already fixed the problem, but i have another :-(

When I choose an item from the dropdownlist, an i press search, the
selected item changes into the first index. How can I resolve this?

Fré

"Pipo" <Pa****@Mayo.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
您可以在数据集(表格)中使用行添加标准值(Selecteer een类型)吗? InsertAt也许然后数据下拉下拉?

Frederik Vanderhaeghe< fr ****************** @ gmail.com>在留言中写道
新闻:uO ************** @ TK2MSFTNGP05.phx.gbl ...
Can you add the standard value (Selecteer een type) in the dataset(table)
with Rows.InsertAt maybe and then databind the dropdown?

"Frederik Vanderhaeghe" <fr******************@gmail.com> wrote in message
news:uO**************@TK2MSFTNGP05.phx.gbl...


我有一个包含的下拉列表应该包含来自
数据库的几个值,我用de代码填写de page_load():
如果不是Page.IsPostBack那么

InlezenConfig()

Dim strsqlDocType As String =" select distinct type from
TBL_Bestanden_Zoeken"

Dim da As New SqlClient。 SqlDataAdapter(strsqlDocType,connectie)

尝试

connectie.Open()

da.Fill(ds," doctype")

ddlDocType.DataSource = ds.Tables(" doctype")

ddlDocType.DataBind()

Catch ex As Exception
最后

connectie.Close()

ddlDocType.Items.Insert(0," Selecteer een type")

ddlDocType.SelectedIndex = 0

结束尝试

结束如果

lblZoeken.Visible = False

dtgZoekResultaten.Visible = True
代码还添加了一个标准值,''Selecteer een type''应该在列表的开头添加。现在的问题是,当我启动
我的
应用程序时,只有值''Selecteer uw type''在下拉列表中,
但是数据库中的其他值也应该在其中。我怎么能解决这个问题呢?

Fré
Hi,

I have a dropdownlist that contains should contain several values from
the
database, I fill it up in de page_load() with this code:
If Not Page.IsPostBack Then

InlezenConfig()

Dim strsqlDocType As String = "select distinct type from
TBL_Bestanden_Zoeken"

Dim da As New SqlClient.SqlDataAdapter(strsqlDocType, connectie)

Try

connectie.Open()

da.Fill(ds, "doctype")

ddlDocType.DataSource = ds.Tables("doctype")

ddlDocType.DataBind()

Catch ex As Exception

Finally

connectie.Close()

ddlDocType.Items.Insert(0, "Selecteer een type")

ddlDocType.SelectedIndex = 0

End Try

End If

lblZoeken.Visible = False

dtgZoekResultaten.Visible = True

The code also adds a standard value, ''Selecteer een type'' that should be
added at the beginning of the list. The problem now is that when i start
my
application only the value ''Selecteer uw type'' is in the dropdownlist,
but
the other values from the database should also be in it. How can i fix
this???

Fré





我已经修复了问题,但我有另一个问题:-(


当我从下拉列表中选择一个项目时,我按下搜索,选择

项目更改为第一个索引。我该如何解决这个问题?

$ b $bFré


Pipo ;< Pa **** @ Mayo.com>在留言中写道

news:%2 **************** @ TK2MSFTNGP05.phx.gbl ...
I already fixed the problem, but i have another :-(

When I choose an item from the dropdownlist, an i press search, the selected
item changes into the first index. How can I resolve this?

Fré

"Pipo" <Pa****@Mayo.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
你能用Rows.InsertAt在数据集(表格)中添加标准值(Selecteer een类型)
然后对下拉列表进行数据绑定吗?

Frederik Vanderhaeghe< fr ****************** @ gmail.com>在消息中写道
新闻:uO ******** ****** @ TK2MSFTNGP05.phx.gbl ...
Can you add the standard value (Selecteer een type) in the dataset(table)
with Rows.InsertAt maybe and then databind the dropdown?

"Frederik Vanderhaeghe" <fr******************@gmail.com> wrote in message
news:uO**************@TK2MSFTNGP05.phx.gbl...


我有一个下拉列表,其中应包含来自
的<数据库,我在de填写page_load()使用此代码:
如果不是Page.IsPostBack那么

InlezenConfig()

Dim strsqlDocType As String =" select from
TBL_Bestanden_Zoeken"

Dim da As New SqlClient.SqlDataAdapter(strsqlDocType,connectie)

尝试

connectie.Open()

da.Fill(ds," doctype")

ddlDocType.DataSource = ds.Tables(" doctype")

ddlDocType.DataBind()

Catch ex As Exception

最后

connectie.Close()

ddlDocType.Items.Insert(0," Selecteer een type)

ddlDocType.SelectedIndex = 0
结束尝试

结束如果

lblZoeken.Visible =错误

dtgZoekResultaten.Visible = True

代码还添加了一个标准值,''Selecteer een type''应该在开头添加名单。现在的问题是,当我启动
我的
应用程序时,只有值''Selecteer uw type''在下拉列表中,
但是数据库中的其他值也应该在其中。我怎么能解决这个问题呢?

Fré
Hi,

I have a dropdownlist that contains should contain several values from
the
database, I fill it up in de page_load() with this code:
If Not Page.IsPostBack Then

InlezenConfig()

Dim strsqlDocType As String = "select distinct type from
TBL_Bestanden_Zoeken"

Dim da As New SqlClient.SqlDataAdapter(strsqlDocType, connectie)

Try

connectie.Open()

da.Fill(ds, "doctype")

ddlDocType.DataSource = ds.Tables("doctype")

ddlDocType.DataBind()

Catch ex As Exception

Finally

connectie.Close()

ddlDocType.Items.Insert(0, "Selecteer een type")

ddlDocType.SelectedIndex = 0

End Try

End If

lblZoeken.Visible = False

dtgZoekResultaten.Visible = True

The code also adds a standard value, ''Selecteer een type'' that should be
added at the beginning of the list. The problem now is that when i start
my
application only the value ''Selecteer uw type'' is in the dropdownlist,
but
the other values from the database should also be in it. How can i fix
this???

Fré




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

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