sdfgrtyu 2015-01-23 00:12 采纳率: 47.4%
浏览 1576

asp.net 求助 ????????

public static object Eval(object container, string expression)
{
if (expression == null)
{
throw new ArgumentNullException("expression");
}
expression = expression.Trim();
if (expression.Length == 0)
{
throw new ArgumentNullException("expression");
}
if (container == null)
{
return null;
}
string[] expressionParts = expression.Split(expressionPartSeparator);
return Eval(container, expressionParts);
}

private static object Eval(object container, string[] expressionParts)
{
object propertyValue = container;
for (int i = 0; (i < expressionParts.Length) && (propertyValue != null); i++)
{
string propName = expressionParts[i];
if (propName.IndexOfAny(indexExprStartChars) < 0)
{
propertyValue = GetPropertyValue(propertyValue, propName);
}
else
{
propertyValue = GetIndexedPropertyValue(propertyValue, propName);
}
}
return propertyValue;
}

public static string Eval(object container, string expression, string format)
{
object obj2 = Eval(container, expression);
if ((obj2 == null) || (obj2 == DBNull.Value))
{
return string.Empty;
}
if (string.IsNullOrEmpty(format))
{
return obj2.ToString();
}
return string.Format(format, obj2);
}

public static object GetDataItem(object container)
{
bool flag;
return GetDataItem(container, out flag);
}

public virtual void DataBind()
{
this.DataBind(true);
}
protected virtual void DataBind(bool raiseOnDataBinding)
{
bool flag = false;
if (this.IsBindingContainer)
{
bool flag2;
object dataItem = DataBinder.GetDataItem(this, out flag2);
if (flag2 && (this.Page != null))
{
this.Page.PushDataBindingContext(dataItem);)
flag = true;
}
}
try
{
if (raiseOnDataBinding)
{
this.OnDataBinding(EventArgs.Empty);
}
this.DataBindChildren();
}
finally
{
if (flag)
{
this.Page.PopDataBindingContext();
}
}
}
C# code
?
1

谁能给我详细解释一下上面代码的意思

  • 写回答

2条回答 默认 最新

  • 微wx笑 Java领域优质创作者 2015-01-23 02:31
    关注

    这是.netFramework的源码吗?
    Eval是DataGrid绑定数据时用来取记录中字段的值的方法;
    DataBind是用来往DataGrid上 绑定数据的

    评论

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮