Trouble w/ GridView Radio buttons

  • Thread starter Thread starter Krish
  • Start date Start date
K

Krish

Hello Gurus,

I have GridView control on web page which has couple of radio button
controls as one group. On editing a particular row in grid, i have to
validate based on user selection on radio button i have to validate another
column data in the grid. Pl. help me with code snippets. Thank you.

<asp:TemplateField HeaderText="Code Translate">

<ItemTemplate>

<asp:RadioButton GroupName="rdTrans" id="rdTranslateP" runat="server"
Text='P' checked='<%# GetCheckP((string)DataBinder.Eval(Container.DataItem,
"in_translate")) %>' ToolTip="Permanant" Enabled="False"/>

<asp:RadioButton GroupName="rdTrans" id="rdTranslateT" runat="server"
Text='T' checked='<%# GetCheckT((string)DataBinder.Eval(Container.DataItem,
"in_translate")) %>' ToolTip="Temporary" Enabled="False"/>

</ItemTemplate>

<EditItemTemplate>

<asp:RadioButton GroupName="rdTransE" id="rdTranslatePE" runat="server"
Text='P' checked='<%# GetCheckP((string)DataBinder.Eval(Container.DataItem,
"in_translate")) %>' ToolTip="Permanant"/>

<asp:RadioButton GroupName="rdTransE" id="rdTranslateTE" runat="server"
Text='T' checked='<%# GetCheckT((string)DataBinder.Eval(Container.DataItem,
"in_translate")) %>' ToolTip="Temporary"/>

</EditItemTemplate>
 
got it...

bool brdP =
(GridView1.Rows[GridView1.EditIndex].FindControl("rdTranslatePE") as
RadioButton).Checked;

if (brdT)

{

if ((GridView1.Rows[GridView1.EditIndex].FindControl("txtDtExpire") as
TextBox).Text.Trim() == "")

{

lblMessage.Text = "Please enter Dt. Expire for Temporary translation";

lblMessage.ForeColor = Color.Red;

return;

}


}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top