如何改善我的代码工作 [英] how can improve my code to work

查看:76
本文介绍了如何改善我的代码工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码用于在gridview中获取检查的行

This code for getting checked rows in gridview

private List<GridViewRow> GetCheckedRows(GridView grd)
    {
        List<GridViewRow> result = new List<GridViewRow>();
        foreach (GridViewRow gridRow in grd.Rows)
        {
            CheckBox chkBox = gridRow.FindControl("checkBoxName") as CheckBox ;
            if (chkBox != null && chkBox.Checked  )
            {
                result.Add(gridRow);
            }
        }
        return result;
    }



当我在浏览器中运行它时,它不会给我任何回应

我该如何改善它的工作能力?

并应放在gridview事件中?

谢谢



When I run it in the browser it dose not give me any response

How can I improve it to work?

and should be put in gridview event ?

Thank you

推荐答案

在浏览器中运行它不会给我任何答复
您期望从以上代码中得到什么样的响应?
您所做的所有代码就是创建一组GridRows,其复选框被选中.完毕.

根据该方法的外观,一切都很好,不需要任何更改/改进.


可能是您在寻找其他东西,但是您在这里表达自己的企图和需求完全失败了.目前,该代码还不错,而且看起来也不是问题.
When I run it in the browser it dose not give me any response
And what kind of response you are expecting from the above code?
All your code does is creates a set of GridRows whose checkbox was found as checked. Done.

Based on what the method looks like doing, all is fine and does not need any change/improvement.


It might be that you are looking for somthing else but you totally failed in expressing on what you were trying and needed here. For now, the code is fine and does not look like an issue in it.


这篇关于如何改善我的代码工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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