小编Sha*_*hal的帖子

如何检查asp.net 4.0中存在的视图状态

我只用asp.net 4.0实现了一个可编辑的网格视图.现在我只使用以下代码将ViewState设置为仅存储此文档:

 protected void DDL_Types1_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList ddl = (DropDownList)sender as DropDownList;
        GridViewRow row = ddl.Parent.Parent as GridViewRow;
        if (!ddl.SelectedItem.Value.Equals("-1"))
        {
            ViewState["type_id"] = ddl.SelectedItem.Value.ToString();
        }
    }
    protected void DDL_StateNames1_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList ddl = (DropDownList)sender as DropDownList;
        GridViewRow row = ddl.Parent.Parent.Parent.Parent as GridViewRow;
        if (!ddl.SelectedItem.Value.Equals("-1"))
        {
            ViewState["state_id"] = ddl.SelectedItem.Value.ToString();
        }
    }
    protected void chk_UserOFC1_CheckedChanged(object sender, EventArgs e)
    {
        CheckBox chk = (CheckBox)sender as CheckBox;
        GridViewRow row = chk.Parent.Parent.Parent.Parent as GridViewRow;
        ViewState["UserOFC"] = chk.Checked.ToString();
    }
    protected …
Run Code Online (Sandbox Code Playgroud)

c# asp.net

1
推荐指数
1
解决办法
1万
查看次数

未为类型“<>f__AnonymousType2`6 定义实例属性“party_id”

我为过滤器列构建了一种辅助方法。

public static class Helper
{
    public static IQueryable<T> FilterForColumn<T>(this IQueryable<T> queryable, string colName, string searchText)
    {
        if (colName != null && searchText != null)
        {
            var parameter = Expression.Parameter(typeof(T), "m");
            var propertyExpression = Expression.Property(parameter, colName);
            System.Linq.Expressions.ConstantExpression searchExpression = null;
            System.Reflection.MethodInfo containsMethod = null;
            // this must be of type Expression to accept different type of expressions
            // i.e. BinaryExpression, MethodCallExpression, ...
            System.Linq.Expressions.Expression body = null;
            Expression ex1 = null;
            Expression ex2 = null;
            Expression converted = null;
            switch (colName) …
Run Code Online (Sandbox Code Playgroud)

c# linq asp.net linq-expressions

0
推荐指数
1
解决办法
5777
查看次数

标签 统计

asp.net ×2

c# ×2

linq ×1

linq-expressions ×1