gridview列自定义邦定数据的错误怎么捕获啊
<Columns>
<asp:BoundField DataField= "xid " HeaderText= "xid " ReadOnly= "True " SortExpression= "xid " />
<asp:BoundField DataField= "xname " HeaderText= "xname " SortExpression= "xname " />
<asp:BoundField DataField= "xsex " HeaderText= "xsex " SortExpression= "xsex " />
<asp:BoundField DataField= "xxf " HeaderText= "xxf " SortExpression= "xxf " />
<asp:TemplateField HeaderText= "xbz " SortExpression= "xbz ">
<EditItemTemplate>
<asp:TextBox ID= "TextBox1 " runat= "server " Text= ' <%# Bind( "xbz ") %> '> </asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID= "Label1 " runat= "server " Text= ' <%# (Eval( "xbz ")).ToString().Substring(0,5) %> '> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:HyperLinkField DataNavigateUrlFields= "xname " DataNavigateUrlFormatString= "news.aspx?fields={0}&field1={0} "
DataTextField= "xname " HeaderText= "links " />
</Columns>
这个是一个gridview 的源文件视图代码。
中间lable1 是我模板化了后用自定义数据 substring(0,5)而问题是。当字段里的字符少于5的时候,系统就会报错,我应该