TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Chevy Mark Sunderland
NA
188
166.8k
Gridview with Filtering option
Jul 20 2012 2:35 PM
Hello there.
First of all I must say that I am a newbie when it comes to net (C#).
Here is my problem.
I can not populate the DropDownList with ID="ddlName" when select the value in the DropDownList with ID="ddlMatr" and vice versa.
If you have link for similar task, please give it me.
Can you explain any one or any sample code related this.
Your help would be very appreciated.
Thanks in advance for your time and hints.
Cheers.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Gridview with Filtering option</title>
</head>
<body>
<form id="form1" runat="server">
<div class="GridviewDiv">
<table style="width: 420px" border="0" cellpadding="0" cellspacing="1" class="GridviewTable">
<tr>
<td style="width: 120px;">
Matr
</td>
<td style="width: 130px;">
Name
</td>
<td style="width: 130px;">
EMail
</td>
</tr>
<tr>
<td style="width: 120px;">
<asp:DropDownList ID="ddlMatr" runat="server" DataSourceID="dsMatr" DataValueField="Matr"
AutoPostBack="true" Width="120px" Font-Size="11px" AppendDataBoundItems="true">
<asp:ListItem Text="All" Value="%" />
</asp:DropDownList>
</td>
<td style="width: 130px;">
<asp:DropDownList ID="ddlName" runat="server" DataSourceID="dsName" DataValueField="Name"
AutoPostBack="true" Width="120px" Font-Size="11px" AppendDataBoundItems="true">
<asp:ListItem Text="All" Value="%" />
</asp:DropDownList>
</td>
<td style="width: 130px;">
<asp:DropDownList ID="ddlEMail" runat="server" DataSourceID="dsEMail" DataValueField="EMail"
AutoPostBack="true" Width="120px" Font-Size="11px" AppendDataBoundItems="true">
<asp:ListItem Text="All" Value="%" />
</asp:DropDownList>
</td>
</tr>
<tr>
<td colspan="5">
<asp:GridView runat="server" ID="gvdetails" ShowHeader="false" AllowPaging="true"
PageSize="10" DataSourceID="dsdetails" AutoGenerateColumns="false" Width="420px"
CssClass="Gridview">
<Columns>
<asp:BoundField DataField="Matr" HeaderText="Matr" ItemStyle-Width="130px" />
<asp:BoundField DataField="Name" HeaderText="Name" ItemStyle-Width="130px" />
<asp:BoundField DataField="EMail" HeaderText="EMail" ItemStyle-Width="120px" />
</Columns>
</asp:GridView>
</td>
</tr>
</table>
</div>
<asp:SqlDataSource ID="dsMatr" runat="server" ConnectionString="<%$ ConnectionStrings:ConnMySQL %>"
ProviderName="<%$ ConnectionStrings:ConnMySQL.ProviderName %>" SelectCommand="Select Matr from tbl_1">
</asp:SqlDataSource>
<asp:SqlDataSource ID="dsName" runat="server" ConnectionString="<%$ ConnectionStrings:ConnMySQL %>"
ProviderName="<%$ ConnectionStrings:ConnMySQL.ProviderName %>" SelectCommand="Select Matr, Name from tbl_1"
FilterExpression=" Matr Like '{0}%'">
<FilterParameters>
<asp:ControlParameter Name="Matr" ControlID="ddlMatr" PropertyName="SelectedValue" />
</FilterParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="dsEMail" runat="server" ConnectionString="<%$ ConnectionStrings:ConnMySQL %>"
ProviderName="<%$ ConnectionStrings:ConnMySQL.ProviderName %>" SelectCommand="Select EMail from tbl_1 WHERE EMail is not null AND email <> ''">
</asp:SqlDataSource>
<asp:SqlDataSource ID="dsdetails" runat="server" ConnectionString="<%$ ConnectionStrings:ConnMySQL %>"
ProviderName="<%$ ConnectionStrings:ConnMySQL.ProviderName %>" SelectCommand="select * from tbl_1"
FilterExpression=" Matr Like '{0}%' and Name Like '{1}%'">
<FilterParameters>
<asp:ControlParameter Name="Matr" ControlID="ddlMatr" PropertyName="SelectedValue" />
<asp:ControlParameter Name="Name" ControlID="ddlName" PropertyName="SelectedValue" />
</FilterParameters>
</asp:SqlDataSource>
</form>
</body>
</html>
Reply
Answers (
2
)
how to make a calender by clicking the image button in asp.net using java script
code blocks not supported error using <% { if on listview