本文介绍了如何访问下拉列表值到GridView选择查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有一个下面给出的下拉列表 < asp:DropDownList ID = ddlExamId runat = server AutoPostBack = True OnSelectedIndexChanged = ddlExamId_SelectedIndexChanged > < / asp:DropDownList > 它有一些值,如1,2等。我还使用网格视图来显示我的数据库值。在Grid View SelectCommand下我想选择那些具有examId = ddlExamId.Text的数据。这是我的SelectCommend。 < asp:SqlDataSource ID = SqlDataSource1 runat = server ConnectionString = <% $ ConnectionStrings :BBAConnectionString1%> SelectCommand = SELECT [Id],[tchId],[stdId],[dept],[subject],[courseCode],[quizNum],[examId],[examDate ],[gainMark] FROM [quizResult]其中examId = <%# this.ddlExamId.Text;% > /> 但这会给我一个这样的错误 解析器错误消息:服务器标签格式不正确。 我该怎么办?请帮我。我是ASP的新手,我的英语也是周。解决方案 ConnectionStrings:BBAConnectionString1%> SelectCommand = SELECT [Id],[tchId],[stdId],[dept],[subject],[courseCode],[quizNum],[examId],[examDate], [gainMark] FROM [quizResult] where examId = <%# this.ddlExamId.Text;% > /> 但是这个给我一个这样的错误 解析器错误消息:服务器标签格式不正确。 我该怎么办?做。请帮我。我是ASP的新手,我的英语也是周。 尝试使用 < asp:SqlDataSource ID = Programs_DropdownList runat = server ConnectionString = <% ConnectionStrings:admConnectionString%> ProviderName = < % I have a Drop down list given below<asp:DropDownList ID="ddlExamId" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlExamId_SelectedIndexChanged"></asp:DropDownList>it have some value like "1","2" etc. I also use a Grid View to show my database value. Under the Grid View SelectCommand I want to select those data that have examId=ddlExamId.Text. Here is my SelectCommend. <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:BBAConnectionString1 %>" SelectCommand="SELECT [Id], [tchId], [stdId], [dept], [subject], [courseCode], [quizNum], [examId], [examDate], [gainMark] FROM [quizResult] where examId="<%# this.ddlExamId.Text;%>" />But this provide me an Error like thisParser Error Message: The server tag is not well formed.what should I do. Please help me. I am new in ASP and my English is also week. 解决方案 ConnectionStrings:BBAConnectionString1 %>" SelectCommand="SELECT [Id], [tchId], [stdId], [dept], [subject], [courseCode], [quizNum], [examId], [examDate], [gainMark] FROM [quizResult] where examId="<%# this.ddlExamId.Text;%>" />But this provide me an Error like thisParser Error Message: The server tag is not well formed.what should I do. Please help me. I am new in ASP and my English is also week.try using this <asp:SqlDataSource ID="Programs_DropdownList" runat="server" ConnectionString="<%ConnectionStrings:admConnectionString %>" ProviderName="<% 这篇关于如何访问下拉列表值到GridView选择查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-21 07:37