---
title: "ASP.Net使用RadioButton控件判断性别"
author: "piperzero"
date: "2013-01-25T09:28:00Z"
tags: []
slug: "asp-net-radiobutton"
draft: false
lastmod: "2013-02-21T19:49:18Z"
id: 1811349
url: "https://piperzero.iteye.com/blog/1811349"
---

新建一个页面，在页面中放入两个RadioButton控件，分别命名为rbFemale和rbMale

判断用户的选择，默认情况下选中一个

if(rbFemale!=null && rbFemale.Checked){

//此处可根据自己需要进行选择操作

info.gender=rbFemale.Text;

}else{

info.gender=rbMale.Text;

}