0
代碼的第一摘錄是從一個ASPX頁面:需要等價的C#代碼,通常發生在ASPX一個評估和演示數據綁定操作
<telerik:RadGrid runat="server" Width="60%" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" ItemStyle-VerticalAlign="Top" HeaderStyle-Width="60%" ID="commentRadGrid" AllowFilteringByColumn="False" AutoGenerateColumns="false"
AllowPaging="true" OnNeedDataSource="someRadGrid" PageSize="100" Skin="Default" AllowSorting="true" AutoPostBack="true" ShowStatusBar="true" AllowCustomPaging="True"
GridLines="none" EnableEmbeddedSkins="false" >
<MasterTableView Width="100%" AutoGenerateColumns="false" AllowFilteringByColumn="False" GridLines="none">
<ItemStyle Wrap="true" Width="60%"/>
<Columns>
blah blah blah
<telerik:GridTemplateColumn Visible="false" AllowFiltering="false">
<ItemTemplate>
<asp:Label ID="invisibleSectionResourceDatabaseIDLabel" runat="server" Text='<%# Eval("SectionBasedResourceDatabaseIDAsString")%>'></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
blah blah blah
</Columns>
</MasterTableView>
<ItemStyle HorizontalAlign="left" />
</telerik:RadGrid>
我想在運行時創建的標籤,並且還配置在運行時,標籤的屬性:
invisibleSectionResourceDatabaseIDLabel = new Label();
invisibleSectionResourceDatabaseIDLabel.ID = colname;
invisibleSectionResourceDatabaseIDLabel.Text =
我不知道如何將invisibleSectionResourceDatabaseIDLabel.Text值在運行時設置爲等效的C#代碼到<%#的eval(「SectionBasedResourceDatabaseIDAsString」)%>表達在C# 。
請幫我在運行時設置的invisibleSectionResourceDatabaseIDLabel.Text值
對不起,聽起來太天真了。 「yourBindingObject」是什麼意思? 「yourBindingObject」是包含數據的DataTable嗎?或者,我是以編程方式創建和配置的ASP標籤? – user1338998
yourBindingObject是要爲其獲取SectionBasedResourceDatabaseIDAsString值的對象。它可能是DataRow(不是DataTable)或其他一些對象。你想分配給你的標籤文本的具體價值是什麼?在運行時這個值被存儲在哪裏? –