单选按钮问题 [英] Radio button question

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

问题描述

我有一个组合框,其中包含一组基于sql

表的项目。


我记得我是'' d在该组合框的开头插入一个值,

,它会说No Item Selected并且当所选索引属性更改为
时,根据选择的项目自动填充该组合框下面的数据网格




作为另一种选择,如果用户想要查看所有内容(客户列表),我会想要在那里放一个单选按钮,这样他们就可以获得所有内容

点击它。


然而,似乎没有与单选按钮相关的onclick事件。

有一个_checkchanged属性似乎什么都不做。在其中,我除了sql和bindgrid命令外还有

,命令隐藏组合框

如果他们想要所有项目。这似乎不起作用。


还有其他/更好的方法吗?


我打算这样做是让他们在所有东西之间做出选择

和限制列表,并明确表示他们不必使用

组合框或上面有一个提交按钮来制作应用程序运行

查询并显示相应的数据。


我正在使用VB& ASP.net。


谢谢,


SC

解决方案

< blockquote> CheckChanged是一个事件,当RadioButton的支票被改变时,它会触发。您应该测试该事件中的代码,因为单击RadioButton时将触发此b / b $ b $事件。虽然,如果只有

一个选项,你可能要考虑使用复选框而不是

radiobutton,因为radiobuttons通常用来从一个选项中选择一个项目/>
系列选项和复选框只能用于一个可能的选项。

Steve Chatham < me@privacy.net>在留言中写道

news:en ************** @ TK2MSFTNGP09.phx.gbl ...

我有一个组合框基于
sql表格填充一组项目。

我记得我会在该组合框的开头插入一个值,
那个'会说'没有选择项目'并且当所选索引属性
被更改时,在所选项目的基础上自动填充基于
的组合框下面的数据网格。

作为替代方案,如果用户想要看到所有的东西(客户名单),
我想在那里放一个单选按钮,当他们点击它们的
时会给他们所有的东西。

然而,似乎那里'没有关于单选按钮的onclick事件。
有一个_checkchanged属性似乎什么都不做。在其中,除了sql和bindgrid命令之外,我还有
命令,如果他们想要所有项目,则隐藏组合
框。这似乎没有用。

还有其他/更好的方法吗?

我这样做的意图是让他们在$ b之间做出选择$ b所有内容和限制列表,并明确表示他们不必使用
组合框或上面有一个提交按钮,以使应用程序运行
查询并显示相应的数据。 br />
我正在使用VB& ASP.net。

谢谢,

SC



" Steve Chatham" ; < me@privacy.net>写在

news:en ************** @ TK2MSFTNGP09.phx.gbl:

作为替代,如果用户想要看到所有东西(顾客名单),我想在那里放一个单选按钮,当他们点击它时会给他们一切。

然而,它似乎在那里没有关于收音机
按钮的onclick事件。有一个_checkchanged属性似乎什么都不做。在
它中,除了sql和bindgrid命令外,我还有命令隐藏组合框,如果他们想要所有项目。这似乎没有用。

还有其他/更好的方法吗?




如果没有onclick事件你将不得不诉诸Javascript触发

a服务器端事件。有一个Javascript事件你可以用它来抓住它。


如果你对第三方组件开放,我可以推荐一个有收音机

按钮的OnClick活动。

-

Chad Z. Hower(又名Kudzu) - http://www.hower.org/Kudzu/

编程是一种反击的艺术形式

ELKNews - 在 http://www.atozedsoftware.com 上获取免费副本/>


似乎复选框做同样的事情 - 什么都没有。


这里是我的代码这两件事中的每一件:


Private Sub rbAllChannels_CheckedChanged(ByVal sender As System.Object,

ByVal e As System.EventArgs)处理rbAllChannels.CheckedChanged


lblDC.Visible = False


cmbChannel.Visible = False


DataGrid1.Visible = True

ss =" select ssoldto,sshipto,ssalesgrp,ssalesrep,sdistrchnl,scustname1,

sstreet, scity,sstate,szip_code,stelephone from tblmaster_shipto"


ss = ss& " group by ssoldto,sshipto,ssalesgrp,ssalesrep,sdistrchnl,

scustname1,sstreet,scity,sstate,szip_code,stelephone order by

scustname1"


BindGrid()


End Sub

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object,ByVal e

As System.EventArgs)处理CheckBox1.CheckedChanged


lblDC.Visible = False


cmbChannel.Visible = False


DataGrid1.Visible = True

ss =" select ssoldto,sshipto,ssalesgrp,ssalesrep,sdistrchnl,scustname1,

sstreet, scity,sstate,szip_code,stelephone from tblmaster_shipto"


ss = ss& " group by ssoldto,sshipto,ssalesgrp,ssalesrep,sdistrchnl,

scustname1,sstreet,scity,sstate,szip_code,stelephone order by

scustname1"


BindGrid()


End Sub

我希望它能解雇我每个人下面的代码

我点击了单选按钮或复选框。它只是坐在那里。


SC


" Scott M." < S - *** @ BADSPAMsnet.net>在消息中写道

新闻:Ol **************** @ TK2MSFTNGP11.phx.gbl ...

CheckChanged是当RadioButton的支票被更改时触发的事件。您应该测试该事件中的代码,因为
单击RadioButton时将触发此事件。虽然,如果有
只有一个选择,你可能要考虑使用复选框而不是
radiobutton,因为radiobuttons通常用于从
系列选项中选择一个项目,复选框可以仅用于一种可能的选择。

" Steve Chatham" < me@privacy.net>在消息中写道
新闻:en ************** @ TK2MSFTNGP09.phx.gbl ...

我有一个组合框,里面填充了一组基于sql

表的项目。

我记得我会在组合
框的开头插入一个值,那个'会说'没有选择项目'并且当所选索引属性


更改时,在


下面的数据网格post_quotes>选中的项目。

作为替代方案,如果用户想要查看所有内容(客户
列表),我

想要收音机


他们

点击它时那里会给他们一切的按钮。

然而,似乎没有onclick事件被绑定收音机



按钮。有一个_checkchanged属性似乎什么都不做。在其中,我


除了sql和bindgrid命令之外还有

,隐藏组合的命令


如果他们想要所有物品。这似乎不起作用。

有没有其他/更好的方法来做到这一点?

我这样做的意图是让他们选择


所有

和一个限制列表,并明确表示他们不必使用


组合框或者在上面有一个提交按钮,使应用程序运行
查询并显示相应的数据。

我正在使用VB& ASP.net。

谢谢,

SC



I have a combo box that gets populated with a group of items based on a sql
table.

I had in mind that I''d insert a value at the beginning of that combo box,
that''d say "No Item Selected" and that when the selected index property was
changed, to automatically populate a datagrid below that combo box based on
the item selected.

As an alternative, if the user wanted to see everything (a customer list), I
wanted to put a radio button there that would give them everything when they
clicked on it.

However, it appears that there''s no onclick event tied to a radio button.
There''s a _checkchanged property that appears to do nothing. In it, I have
in addition to the sql and bindgrid command, commands to hide the combo box
if they want all items. That doesn''t appear to work.

Is there another/better way to do this?

My intention of doing it this way was to let them choose between everything
and a restricted list, and make it obvious that they did not have to use the
combo box or have a submit button above to make the application run the
query and show the appropriate data.

I''m using VB & ASP.net.

Thanks,

SC

解决方案

CheckChanged is the event that does fire when a RadioButton''s check gets
changed. You should test the code that you have in that event because this
event will fire when the RadioButton is clicked. Although, if there is only
one choice, you may want to consider using a checkbox instead of a
radiobutton as radiobuttons are typically used to pick one item from a
series of choices and checkboxes can be used for just one possible
selection.
"Steve Chatham" <me@privacy.net> wrote in message
news:en**************@TK2MSFTNGP09.phx.gbl...

I have a combo box that gets populated with a group of items based on a sql table.

I had in mind that I''d insert a value at the beginning of that combo box,
that''d say "No Item Selected" and that when the selected index property was changed, to automatically populate a datagrid below that combo box based on the item selected.

As an alternative, if the user wanted to see everything (a customer list), I wanted to put a radio button there that would give them everything when they clicked on it.

However, it appears that there''s no onclick event tied to a radio button.
There''s a _checkchanged property that appears to do nothing. In it, I have in addition to the sql and bindgrid command, commands to hide the combo box if they want all items. That doesn''t appear to work.

Is there another/better way to do this?

My intention of doing it this way was to let them choose between everything and a restricted list, and make it obvious that they did not have to use the combo box or have a submit button above to make the application run the
query and show the appropriate data.

I''m using VB & ASP.net.

Thanks,

SC



"Steve Chatham" <me@privacy.net> wrote in
news:en**************@TK2MSFTNGP09.phx.gbl:

As an alternative, if the user wanted to see everything (a customer
list), I wanted to put a radio button there that would give them
everything when they clicked on it.

However, it appears that there''s no onclick event tied to a radio
button. There''s a _checkchanged property that appears to do nothing. In
it, I have in addition to the sql and bindgrid command, commands to hide
the combo box if they want all items. That doesn''t appear to work.

Is there another/better way to do this?



If there is no onclick event you will have to resort to Javascript to trigger
a server side event. There is a Javascript event you can use to catch this.

If you are open to third party components, I can recommend one that has radio
buttons with OnClick events.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
ELKNews - Get your free copy at http://www.atozedsoftware.com


It appears that the checkbox does the same thing - nothing.

Here''s the code I have for each of those 2 things:

Private Sub rbAllChannels_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles rbAllChannels.CheckedChanged

lblDC.Visible = False

cmbChannel.Visible = False

DataGrid1.Visible = True

ss = "select ssoldto, sshipto, ssalesgrp, ssalesrep, sdistrchnl, scustname1,
sstreet, scity, sstate, szip_code, stelephone from tblmaster_shipto "

ss = ss & " group by ssoldto, sshipto, ssalesgrp, ssalesrep, sdistrchnl,
scustname1, sstreet, scity, sstate, szip_code, stelephone order by
scustname1"

BindGrid()

End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles CheckBox1.CheckedChanged

lblDC.Visible = False

cmbChannel.Visible = False

DataGrid1.Visible = True

ss = "select ssoldto, sshipto, ssalesgrp, ssalesrep, sdistrchnl, scustname1,
sstreet, scity, sstate, szip_code, stelephone from tblmaster_shipto "

ss = ss & " group by ssoldto, sshipto, ssalesgrp, ssalesrep, sdistrchnl,
scustname1, sstreet, scity, sstate, szip_code, stelephone order by
scustname1"

BindGrid()

End Sub
I was expecting it to fire the code I have below each one of those whenever
I clicked the radio button or the checkbox. It just sits there.

SC


"Scott M." <s-***@BADSPAMsnet.net> wrote in message
news:Ol****************@TK2MSFTNGP11.phx.gbl...

CheckChanged is the event that does fire when a RadioButton''s check gets
changed. You should test the code that you have in that event because this event will fire when the RadioButton is clicked. Although, if there is only one choice, you may want to consider using a checkbox instead of a
radiobutton as radiobuttons are typically used to pick one item from a
series of choices and checkboxes can be used for just one possible
selection.
"Steve Chatham" <me@privacy.net> wrote in message
news:en**************@TK2MSFTNGP09.phx.gbl...

I have a combo box that gets populated with a group of items based on a sql

table.

I had in mind that I''d insert a value at the beginning of that combo box, that''d say "No Item Selected" and that when the selected index property


was

changed, to automatically populate a datagrid below that combo box based


on

the item selected.

As an alternative, if the user wanted to see everything (a customer list), I

wanted to put a radio button there that would give them everything when


they

clicked on it.

However, it appears that there''s no onclick event tied to a radio


button. There''s a _checkchanged property that appears to do nothing. In it, I


have

in addition to the sql and bindgrid command, commands to hide the combo


box

if they want all items. That doesn''t appear to work.

Is there another/better way to do this?

My intention of doing it this way was to let them choose between


everything

and a restricted list, and make it obvious that they did not have to use


the

combo box or have a submit button above to make the application run the
query and show the appropriate data.

I''m using VB & ASP.net.

Thanks,

SC




这篇关于单选按钮问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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