1
http://www.asp.net/data-access/tutorials/adding-a-gridview-column-of-radio-buttons-csasp.net gridview單選按鈕
請參考上面的鏈接。如何以編程方式選擇RadioButton?
http://www.asp.net/data-access/tutorials/adding-a-gridview-column-of-radio-buttons-csasp.net gridview單選按鈕
請參考上面的鏈接。如何以編程方式選擇RadioButton?
void SetPrimaryContactID()
{
if (grvCustomerContact.Rows.Count > 0)
{
foreach (GridViewRow gr in grvCustomerContact.Rows)
{
Label l = (Label)gr.FindControl("lblContacts_ID");
bool s = hd_PrimaryContact.Value.Equals(l.Text);
if (hd_PrimaryContact.Value.Equals(l.Text))
{
Literal output = (Literal)gr.FindControl("RadioButtonMarkup");
output.Text = string.Format(@"<input type='radio' name='PrimaryConactGroup'" + @"id='RowSelector{0}' value='{0}' checked='checked' />", gr.RowIndex);
}
}
}
}
不要忘記接受你自己的答案是正確的(使用左側的綠色勾號) – abatishchev 2010-11-01 10:42:39