0
我在我的數據表中有200行,其中有很多「」(string.empty)值,所以我需要在數據綁定之前從我的數據表中刪除它們。ASP.net數據綁定非空行
我不知道如何將數據綁定數組
我的數據列表:
<asp:DataList
id="list1"
runat="server">
<ItemTemplate>
<cc1:SWCLabel
runat="server"
Text ='<%# Eval("myfield1")%>'
/>
</ItemTemplate>
</asp:DataList>
// My code behind
DataView view = dt3.DefaultView;
DataRow[] rows = dt3.Select("myfield1 <> ''");
... // Something here
普萊舍,協助我與非LINQ的解決方案,因爲我不能夠在此刻undertand它。
謝謝!
它扔下我一個運行時異常說我說的System.Data.DataRow不包含名稱爲「myfield1」的屬性。 – anmarti
@senyortoni:如果您再次將其轉換爲'DataTable',那麼它是一樣的嗎? 'list1.DataSource = dataSource.CopyToDataTable();'。該表是否真的包含名爲「myfield1」的「DataColumn」,其類型爲「string」? –
是的,它包含這個字段,並且當沒有linq過濾器的數據綁定時不會崩潰。 – anmarti