给edititemtemplate赋值 [英] assign a value to edititemtemplate
本文介绍了给edititemtemplate赋值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在rowediting事件的griview中编辑项目模板.我在后面的代码中分配值以编辑项目模板.代码为:
((TextBox)objGridViewRow.Cells [2] .FindControl(" txtFName"))).Text = obj.FullName;
txtFName是编辑项模板.但是在为其分配值的同时,会出现nullReference异常.我该如何做..帮助我..
I want to edit item template in a griview on rowediting event.i assign value to edit item template on code behind.the code is:
((TextBox)objGridViewRow.Cells[2].FindControl("txtFName")).Text = obj.FullName;
txtFName is the edit item template.butwhile assigning value to this, nullReference Exception arises.how can i do this..help me..
推荐答案
使用它会帮你
use this i think it will help you
((TextBox)objGridViewRow.FindControl("txtFName"))")).Text = obj.FullName==null ? "" : obj.FullName;
检查obj.FullName值中将包含的内容是否为空.
check that what will come in obj.FullName value check it is null or not.
这篇关于给edititemtemplate赋值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文