gridview的问题 [英] problem with gridview

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

问题描述

我有gridview,我在gridview中选中了复选框,但是我想在gridview外面的radiobutton点击中隐藏这个复选框... plz帮帮我?

I have gridview and i took checkbox in gridview but i want to hide this checkbox on radiobutton click which is outside the gridview...plz help me?

推荐答案

您可以根据radiobutton的选定值隐藏整列。您可以在下面的链接中实现网格视图的OnRowCreated事件



如何隐藏GridView中的TemplateField列
You can hide whole column based on radiobutton''s selected value. You can implement OnRowCreated event of grid view mentioned at the link below

How to hide a TemplateField column in a GridView


我给你一个使用这个的示例代码可以控制模板字段中Gridview中任何控件的属性



I''me giving an example code using this you can control property on any control in Gridview in Templated Field

protected void loadcontrols()
    {
        for (int i = 0; i < gvReply.Rows.Count; i++)
        {
            Button btnDelete = gvReply.Rows[i].FindControl("btnDelete") as Button;
            
            HiddenField hf=gvReply.Rows[i].FindControl("hfID") as HiddenField;
            
            if (Session["userid"].ToString() == hf.Value)
            {
               btnDelete.Visible = true;
              
            }
        }
    } 





它是Button控件的示例,您也可以控制复选框的属性。



it is the example of a Button control , instead you can control the property of checkbox also.


这篇关于gridview的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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