菜鸟!使用AccessDataSource中的数据 [英] NOOB! Using Data from AccessDataSource
本文介绍了菜鸟!使用AccessDataSource中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用列中的值来确定是否在Label中包含链接。
其他人编写了Select命令来拉取数据进入AccessDataSource2,我可以在标记中使用#Eval获取值。 但我无法获得相同的价值,可以在我的If ... then语句中使用。
这就是我所拥有的:
< asp:DataList ID =" DataList1" RUNAT = QUOT;服务器"的DataSourceID = QUOT; AccessDataSource2">
< ItemTemplate>
< ul>< li>
<%
Dim x As String = CType(AccessDataSource2.DataField(" WebAddress"),String)
如果x<> "#"那么
%>
< a target ='_ blank'href ="<%#Eval(" WebAddress")%>">
<%
否则
结束如果
%>
< asp:Label ID =" TitleLabel"的CssClass = QUOT; eventheader" RUNAT = QUOT;服务器" Text ='<%#Eval(" Title")%>'/>< / a> <峰; br />
< asp:Label CssClass =" eventdate" ID = QUOT; CourseDateLabel" RUNAT = QUOT;服务器" Text ='<%#Eval(" CourseDate")%>'/> <峰; br />
< asp:Label CssClass =" eventdate" ID = QUOT; CourseLengthLabel" RUNAT = QUOT;服务器" Text ='<%#Eval(" CourseLength")%>'/>
< / li>< / ul>
< / ItemTemplate>
< / asp:DataList>
< asp:AccessDataSource ID =" AccessDataSource2" RUNAT = QUOT;服务器"
DataFile ="〜/ App_Data / coursdata.mdb"
SelectCommand =" SELECT [Title],[CourseDate],[CourseLength],[ShortDescription],[WebAddress] FROM [课程查询] WHERE([Upcoming] =?)">
< SelectParameters>
< asp:QueryStringParameter DefaultValue =" True"名称= QUOT;即将"
QueryStringField =" Upcoming"类型="布尔" />
< / SelectParameters>
< / asp:AccessDataSource>
请帮助。
解决方案
看起来像ASP.Net。此论坛不涉及ASP.Net特定问题,但这一个: http://forums.asp.net/
I'm trying to use the value in a column to determine whether or not to include a link in a Label.
Someone else wrote the Select command to pull the data into the AccessDataSource2, and I can get to the value using #Eval, in the markup. But I can't get the same value, to use in my If...then statement.
Here's what I have:
<asp:DataList ID="DataList1" runat="server" DataSourceID="AccessDataSource2"> <ItemTemplate> <ul><li> <% Dim x As String = CType(AccessDataSource2.DataField("WebAddress"), String) If x <> "#" Then %> <a target='_blank' href="<%#Eval("WebAddress") %>"> <% Else End If %> <asp:Label ID="TitleLabel" CssClass="eventheader" runat="server" Text='<%# Eval("Title") %>' /></a> <br/> <asp:Label CssClass="eventdate" ID="CourseDateLabel" runat="server" Text='<%# Eval("CourseDate") %>' /> <br/> <asp:Label CssClass="eventdate" ID="CourseLengthLabel" runat="server" Text='<%# Eval("CourseLength") %>' /> </li></ul> </ItemTemplate> </asp:DataList> <asp:AccessDataSource ID="AccessDataSource2" runat="server" DataFile="~/App_Data/coursdata.mdb" SelectCommand="SELECT [Title], [CourseDate], [CourseLength], [ShortDescription], [WebAddress] FROM [Courses Query] WHERE ([Upcoming] = ?)"> <SelectParameters> <asp:QueryStringParameter DefaultValue="True" Name="Upcoming" QueryStringField="Upcoming" Type="Boolean" /> </SelectParameters> </asp:AccessDataSource>
Help, please.
解决方案
Looks like ASP.Net. This forum doesn't cover ASP.Net specific issues, but this one: http://forums.asp.net/
这篇关于菜鸟!使用AccessDataSource中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文