在网格视图中发布radiobuttons在回发后不会保留选择。 [英] posting radiobuttons inside a gridview do not persist selection after postback..

查看:58
本文介绍了在网格视图中发布radiobuttons在回发后不会保留选择。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我在模板字段中有一个带输入无线电控件的表单。

当用户选择一个选项时,按一下按钮

选择消失..我想在按钮发回发后继续选择




我尝试过使用findcontrol但它返回null,并且不知道怎么用

确保在按钮

动作进行回发后选择的无线电仍然存在。


在此先感谢,


Carlos。

Hi all,

I have a form with an input radio control in a template field.
When the user selects an option, and press a button
the selection disappears.. I would like the selection to
persist after the button makes the postback,

I tried using the findcontrol but it returns null, and do not know how
to make sure that the radio selected persist after the button
action makes the postback.

Thanks in advance,

Carlos.

推荐答案



在模板字段中的radiobutton控件上启用viewstate吗?

Carlos写道:

enable viewstate on the radiobutton control in the template field?

Carlos wrote:

大家好,


我在模板字段中有一个带输入无线电控件的表格。

当用户选择一个选项时,按一个按钮

选择消失..我希望选择

持续af按钮使回发,


我尝试使用findcontrol但它返回null,并且不知道怎样

以确保选择的无线电持续存在按钮后

动作进行回发。


提前致谢,


Carlos。
Hi all,

I have a form with an input radio control in a template field.
When the user selects an option, and press a button
the selection disappears.. I would like the selection to
persist after the button makes the postback,

I tried using the findcontrol but it returns null, and do not know how
to make sure that the radio selected persist after the button
action makes the postback.

Thanks in advance,

Carlos.


谢谢你的回复。但是,我已经将enableviewstate设置为

true,

,问题是在这个片段中,控件变量为空。

即显然它找不到控件:


for(int i = 0; i< GridView2.Rows.Count; i ++)


{


GridViewRow row = GridView11.Rows [i];


HtmlInputRadioButton rb =

(HtmlInputRadioButton) (row.FindControl(" rbMonday"));


if(rb.Checked == true)


{


Response.Write(" found it ..");



//第2列是名称栏


}

}


谢谢,


Carlos。


" kferron" < ke ********** @ gmail.comwrote in message

news:11 ******************** **@h48g2000cwc.googlegr oups.com ...
Thanks, for the reply. However, I already have the enableviewstate set to
true,
and the problem is that in this snippet, the control variable comes null.
i.e. apparently it can not find the control:

for (int i = 0; i < GridView2.Rows.Count; i++)

{

GridViewRow row = GridView11.Rows[i];

HtmlInputRadioButton rb =
(HtmlInputRadioButton)(row.FindControl("rbMonday") );

if (rb.Checked == true)

{

Response.Write("found it..");


// Column 2 is the name column

}
}

Thanks,

Carlos.

"kferron" <ke**********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...

>

启用模板字段中radiobutton控件的viewstate?


Carlos写道:
>
enable viewstate on the radiobutton control in the template field?

Carlos wrote:

>大家好,

我有一个带输入的表格模板字段中的无线电控制。
当用户选择一个选项,然后按一个按钮
时,选择消失..我希望选择按钮在按钮进行回发后仍然存在,

我尝试使用findcontrol但它返回null,并且不知道如何确保选中的单选按钮
动作后回复后仍然存在。

提前致谢,卡洛斯。
>Hi all,

I have a form with an input radio control in a template field.
When the user selects an option, and press a button
the selection disappears.. I would like the selection to
persist after the button makes the postback,

I tried using the findcontrol but it returns null, and do not know how
to make sure that the radio selected persist after the button
action makes the postback.

Thanks in advance,

Carlos.





你有runat =" server"在html单选按钮?


也许你可以粘贴templatefield html。

Carlos写道:

Do you have runat="server" in the html radio button?

Perhaps you could paste the templatefield html.
Carlos wrote:

谢谢你的回复。但是,我已经将enableviewstate设置为

true,

,问题是在这个片段中,控件变量为空。

即显然它找不到控件:


for(int i = 0; i< GridView2.Rows.Count; i ++)


{


GridViewRow row = GridView11.Rows [i];


HtmlInputRadioButton rb =

(HtmlInputRadioButton) (row.FindControl(" rbMonday"));


if(rb.Checked == true)


{


Response.Write(" found it ..");



//第2列是名称栏


}


}


谢谢,


Carlos。


" kferron" < ke ********** @ gmail.comwrote in message

news:11 ******************** **@h48g2000cwc.googlegr oups.com ...
Thanks, for the reply. However, I already have the enableviewstate set to
true,
and the problem is that in this snippet, the control variable comes null.
i.e. apparently it can not find the control:

for (int i = 0; i < GridView2.Rows.Count; i++)

{

GridViewRow row = GridView11.Rows[i];

HtmlInputRadioButton rb =
(HtmlInputRadioButton)(row.FindControl("rbMonday") );

if (rb.Checked == true)

{

Response.Write("found it..");


// Column 2 is the name column

}
}

Thanks,

Carlos.

"kferron" <ke**********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...


启用模板字段中radiobutton控件的viewstate?

Carlos写道:

enable viewstate on the radiobutton control in the template field?

Carlos wrote:

大家好,


我有一个带有输入无线电控制的表格模板字段。

当用户选择一个选项时,按一个按钮

选择消失..我希望选择

持续存在在按钮进行回发之后,


我尝试使用findcontrol但是它返回null,并且不知道

如何确保选择的无线电持续存在按钮后

动作进行回发。


提前致谢,


Carlos。
Hi all,

I have a form with an input radio control in a template field.
When the user selects an option, and press a button
the selection disappears.. I would like the selection to
persist after the button makes the postback,

I tried using the findcontrol but it returns null, and do not know how
to make sure that the radio selected persist after the button
action makes the postback.

Thanks in advance,

Carlos.


这篇关于在网格视图中发布radiobuttons在回发后不会保留选择。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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