在GridView中实现RadioButton的单选功能,主要是从两个方面来考虑
1.客户端
    在客户端来开发,我们主要考虑两个方面的问题
    1. 怎么取得GridView所在行的主键值
    2. 怎么在选定某个选项,提交给服务器以后,再能保持选项是被选上的
    这个问题可以这样解决,我们知道,在客户端,RadioButton的HTML代码是
    <input type="radio"   />
    我们可以通过一个Literal空间,在GridView的OnRowCreated事件中动态的来控制这个的HTML代码就可以
    服务器可以通过Request.Form["**"]来得到该行记录的主键
2.服务器端
    其原理也是修改RadioButton的HTML代码.扩张RadioButton类,写成一个服务器控件.
    相关代码如下:
    
 1RadioButton in GridViewusing System;
 2RadioButton in GridViewusing System.Collections.Generic;
 3RadioButton in GridViewusing System.ComponentModel;
 4RadioButton in GridViewusing System.Text;
 5RadioButton in GridViewusing System.Web;
 6RadioButton in GridViewusing System.Web.UI;
 7RadioButton in GridViewusing System.Web.UI.WebControls;
 8RadioButton in GridView
 9RadioButton in GridViewnamespace Utilities
10    }

    

相关文章:

  • 2021-10-13
  • 2022-02-13
  • 2022-12-23
  • 2022-03-06
  • 2022-03-06
  • 2022-12-23
  • 2021-11-16
  • 2021-11-20
猜你喜欢
  • 2022-12-23
  • 2022-02-19
  • 2022-12-23
  • 2022-12-23
  • 2021-11-07
  • 2021-09-26
  • 2022-12-23
相关资源
相似解决方案