0

I have a checkbox that needs to update when the user changes the selected item in a GridView. I can programmatically assign the database value to the checkbox on page load. That works fine. But I can't get the checkbox to refresh inside my GridView_SelectedIndexChanged function.

radioBtnDownPmtBrwd.Checked = Convert.ToBoolean(lstBorrowerInfo.rbDwnPmtBrwd);
radioBtnEndorser.Checked = Convert.ToBoolean(lstBorrowerInfo.rbEndorser);

The code above works great on Page_Load. How do I trigger the screen to refresh when I change the checked/unchecked status from the code behind?

4

1 回答 1

1

您需要GridView在事件处理程序代码中重新绑定所选项目的更改。GridView只会DataSource在最近的DataBind方法调用中显示它所说的内容。

将它放在 anUpdatePanel中将消除标准 ASP.NET WebForms 回发时发生的闪烁刷新,但UpdatePanels 不是万能药。

于 2013-07-21T04:31:25.253 回答