在GridView中使用Templatefield [英] Working With Templatefield in GridView

查看:59
本文介绍了在GridView中使用Templatefield的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,我有一个GridView,其中有两个模板字段,一个是RadioButton,下一个是TextBox,在单击单选按钮时,我必须在TextBox中设置一个焦点...

不允许多项选择RadioButton ...

最后,应该将其保存在数据库中.我将负责数据库的维护,但是只有选择对我很重要...

谢谢你
Sushil Dharmar ...

Hi Friends I have a GridView in which two Template Field is there one is RadioButton and the next one is TextBox on the Click of the Radion Button I have to Setup an focus in the TextBox...

Multiple Selection of RadioButton Shouldn''t be allowed...

And Finally It should be saved in the DataBase I will take care of the DataBase, but only the selection is important me...

Thanking you
Sushil Dharmar...

推荐答案

protected void rbSelector_CheckedChanged(object sender, System.EventArgs e)
{
    //Clear the existing selected row 
    foreach (GridViewRow oldrow in GridView1.Rows)
    {
        ((RadioButton)oldrow.FindControl("rbSelector")).Checked = false;
    }
    //Set the new selected row
    RadioButton rb = (RadioButton)sender;
    GridViewRow row = (GridViewRow)rb.NamingContainer;
    ((RadioButton)row.FindControl("rbSelector")).Checked = true;
    ((TextBox)row.FindControl("textBoxID")).Focus();
}


[ ^ ]


Source[^]


这篇关于在GridView中使用Templatefield的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆