ASP.NET中的数据绑定
我将数据网格与表绑定。有一个datagrid列作为--ASP.NET中的数据绑定,asp.net,Asp.net,我将数据网格与表绑定。有一个datagrid列作为-- ,测试123“ 但我只想绑定值“test123” 请建议怎么做? 提前感谢。我可能会这样做。请使用模板列,而不是边界列: <asp:TemplateColumn HeaderText="Title"> <ItemTemplate><%#GetID(Eval("Title"))%></ItemTemplate> </asp:TemplateColumn> 在将字符串绑定到d
,测试123“
但我只想绑定值“test123”
请建议怎么做?
提前感谢。我可能会这样做。请使用模板列,而不是边界列
:
<asp:TemplateColumn HeaderText="Title">
<ItemTemplate><%#GetID(Eval("Title"))%></ItemTemplate>
</asp:TemplateColumn>
在将字符串绑定到datagrid之前,我需要对其进行裁剪。但是我如何才能做到呢?
<asp:TemplateColumn HeaderText="Title">
<ItemTemplate><%#GetID(Eval("Title"))%></ItemTemplate>
</asp:TemplateColumn>
protected static string GetID(object Title)
{
string[] queryString = Title.ToString().Split('?');
// Only if you're sure you want the value of the first element in the QueryString
return queryString[1].Split('=')[1];
}