Gridview Filter using Dropdown where dropdown is populated from a distinct list in the Gridview - SQL datasource...is it possible?

I have a report page that shows the user who accessed pages, when they accessed it, and the page they accessed.  I have it attached to some dates, so they can easily filter the search down.  What I want to do is to further filter the list with a dropdown of users, so they can see which user viewed what pages over a certain time frame.  I know how to query the database for a list of users and then populate the dropdown with all the users...then attach that dropdown to the sqldatasource for the gridview to filter it down by user.   But, what if I just want to populate the dropdown with only the unique users that appear in the current gridview? Is there a way to do that?

Textboxes: StartDate__________ EndDate____________  Dropdown: ________ Users   Button: Search

SQL Datasource: select displayname, username, pagename, accessdate from pagelog where accessdate>= @startdate and enddate>=@enddate and username like '%' + @user + '%'  [parameters attached to text fields of textboxes and selected value of user dropdown] This populates the gridview with current values that the user has selected. That's good.

Now, how can I populate the users dropdown from the gridview's sqldatasource getting only the unique user names?  Is that possible?

0
taemike
9/14/2007 3:58:19 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies
1120 Views

Similar Articles

[PageSpeed] 45

I would suggest binding your users dropdownlist to a second SqlDataSource which separately retrieves the unique list of users from your database

0
squaret
9/14/2007 4:28:03 PM
Reply:

Similar Artilces:

Can I populate a Dropdown list in a GridView from another Dropdown list
Hi there, I have a Gridview control that contains 2 DDLs. The first one is populated on page load (from a Generic list in the code behind) and is working with no problems. I want to populate the 2nd DDL by making a selection in the first DDL which in turn would call a DB method and cause a postback. I've tried using the "OnSelectedIndexChanged" method for the DDL and the "FindControl" method for the 2nd DDL, but the GridView can't find it on Postback and throws an error. I've also tried using the "onSelectedIndexChanged" method for the GridView bu...

"Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control" when using cascading dropdown list in Gridview
Hi, it seems my sad little attempts at developing ASP.NET web page are full of problems.. Earlier I asked a question about using a dropdown list in the gridview to update a table. Someone helped me with that. Thank you. But now I run into another problem after solving that one... Basically, I have a gridview control that reads data from the main table (table name: transaction). When a user clicks the "Edit" link, the user will be able to select an item from a dropdown list, which reads from a second table (table name: source), and when the user click "Update" li...

Dropdown list fail to control output of Gridview datasource
I have a Gridview display a query based on a parameter of dropdownlist which select months. The codes are as follows:- <asp:DropDownList ID="DropDownList1" runat="server"> <asp:ListItem Value="1">Jan</asp:ListItem> <asp:ListItem Value="2">Feb</asp:ListItem>etc Datasource: Select xyz from TableA where Month(Birthday) = ?<SelectParameters><asp:ControlParameter ControlID="DropDownList1" Name="Month(Birthday)"PropertyName="SelectedValue" Type="Int32" /></SelectParamet...

Dropdown list and tying in the selection to populating 5 other gridview / repeater controls
On one page I have a drop down control that is tied to my backend sql database via a sql data source control.   Based off of the selection that the user makes I want multiple gridviews (4 to be exact) and 2 repeaters to populate with their information.   Now those 6 controls are getting their info from other sql data source controls on the page -- how can I use a parameter control on my select statments and relate it to the SelectItem.Value of my drop down list that the user first selects when they come on the page.   As always guys thanks for your help - ...

how do i populate a gridview by selecting an option from the dropdown which is in gridview
the issue is like i have a gridview and i want to populate the gridview by selecting an option from the dropdown which is in gridview itself. This article explains the same http://www.asp.net/learn/data-access/tutorial-07-vb.aspx  Vikram www.vikramlakhotia.comPlease mark the answer if it helped you thanks vik20000in for u r reply however the reply is not the solution to what i have asked. in your post the dropdown list is outside the gridview but i want the dropdown to be inside the gridview n when i select any value from it the gridview should be filled. hope u got it know any co...

Filter a DropDown from another DropDown inside GridView
Hi there, I'm pretty sure this is an easy question, I really would like to get help. Inside a gridview I have this templatefields, what I want to do is filter the DropDownList2 according to the item selected in the DropDownList1. Each DropDownList uses its own SqlDataSource because I retrieve the data drom diferent tables for each DropDownI just can't realize how to do it. Any help would be appreciated, thanks!!! <asp:TemplateField HeaderText="PROVEEDOR" SortExpression="infoClProveedor"> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("infoClProveedo...

Using a Dropdown to Filter a GridView
I have a gridview that is pulling information from a sqldatasource.  There is a status column that has 3 values: Open, Open and Pending, and Closed.  Above the GridView, I need to have a dropdown that has Open, Open and Pending, and Closed as the 3 choices and need to filter the GridView by using that dropdown.  The dropdown isn't linked to a sqldatasource.  I am using list items in the dropdown.  I started programming the code behind like below.  Obviously I'm doing something wrong and hoping someone can point me in the right direction.Private...

Gridview and Dropdown List Filters
I have a gridview of around 20 columns which is bound to an sqldatasource.After the gridview is populated I need to have around 8 dropdownlists to act as filters for the gridview.  IS this possible to do?An idiots guide would be great J   Not sure if this will fit your requirements but I think this will lead you the way:ASP.NET GridView Filtering with DropDownList GridView-Search Control Regards,Vinz"Code, Beer and Music" that's my way of being a programmer!How to get your Forum Question Answered | Blog | CodeASP.NET   First link is exactly what im after -...

Populate Dropdown lists in GridView
I have three dropdown lists in my gridview. I'm able to populate the ones in the EmptyDataRow and Footer using the code below. How do I populate the one in the EditItemTemplate? When editing it needs to default to show the selected item in the list also.protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.EmptyDataRow) { DropDownList ddl = (DropDownList)e.Row.FindControl("ddlChargeCodeEmptyInsert"); PopulateChargeCodeList(ddl); } else if (e.Row.RowType == DataControlRowType.Footer) { DropDownL...

Trying to use the FAQ " Sorting and paging in the GridView control when not using data source controls "Sorting and paging in the GridView control when not using..."
and I am not getting the results I had hoped for.  I keep getting a "Compiler Error Message: CS0123: No overload for 'AdhocJobGridView_PageIndexChanged' matches delegate 'System.EventHandler'".   Here is my event handling... protected void AdhocJobGridView_PageIndexChanged(object sender, GridViewPageEventArgs e){ try { AdhocJobGridView.DataSource = wsBaseInfoArray; AdhocJobGridView.PageIndex = e.NewPageIndex; AdhocJobGridView.DataBind(); }catch (Exception ex) {throw ex; }   Here is my aspx... <asp:GridView ID="AdhocJobGridView...

How to get gridview datasource from a dropdown list
Hi All, I have 4 drop down lists in my form . 1st & 2nd  are used to get teh "start Month" ( in which 1st dropdown populates Month and 2nd Populates years) so when ever the user selects the 1st and 2nd drop down he gets teh startMonth : i.e., Jan 2008  and similarly 3rd and 4th drop down gives the end month. ( some thing like june 2008) Now my problem is when ever the user selects the startmonth : jan 2008 and end month : june 2008 then I have to show different gridviews for each month. i.,e I have to show data in this form Jan 2008      chi...

How to show Dropdown list in a GridView control
Hi , I am trying to genearte a View that will have 2 columns coming from Database  no editing of this columns is allowed 1 Col is Dropdown which will have data from a Table I col which will have Constant Value entered by user   How do I do it with Gridview also If I already add columns in Desing View for Grid how do I add rows in code to a grid   Also If I use DataRepeater how do I put /add rows to it through a simple loop This has to be done because I am manipulating data once it comes from DataBase Thanks in Advance   Read this http://www.gridviewg...

Can a DropDown list populate a Gridview??
I'm trying to create an easy way to navigate through the records in my gridview, I currently have about 100 record, and I have the paging on my gridview set to 10 per page. Currently if I'm searching for a certain record I have to guess which page and then select the record I want to display in the Detailsview. Is there a way to create a dropdown list above the Gridview, the dropdown list could contain employee names, when you select a name only that record shows in the gridview... Is that possible? or is there a better way to search for a certain record quickly? Yes you can easily...

Dropdown List in GridView not populating (so it says...)
First, I searched the forums and couldn't find a thread that matched my problem.  I also searched Google for my error message (in quotes) and received 9 results.  If you know of a post/article that deals with my specific problem, I'd love to read it.I have a TemplateField in a GridView that consists of a textbox that's populated from another database, specifically, I'm pulling "CategoryName" from my [Categories] table, and upon the update command, I want to insert its value into the "Category" column of my [Activities] table.  When I click &...

Populating dropdown lists in GridView Template
I have a gridview with 2 dropdown lists when in Edit mode.  The second list is dependent on the first.  The first is a request_class, and the second is a request.  I have caught the SelectedIndexChanged in the first list in order to appropriately load the second list.  This works, as long as the first list's selection changes.  But in Edit mode, the selection in the first list is more likely to be right then wrong, so the event to filter the 2nd list does not occur. What event might I trap to get the value of the initially selected item in the first dropdown?&nb...

Web resources about - Gridview Filter using Dropdown where dropdown is populated from a distinct list in the Gridview - SQL datasource...is it possible? - asp.net.presentation-controls

Datasource - Wikipedia, the free encyclopedia
A DataSource object has properties that can be modified when necessary. For example, if the data source is moved to a different server, the property ...

Inverness Graham Acquires DataSource
Inverness Graham , a lower middle market private equity firm headquartered in suburban Philadelphia, has acquired DataSource , a print supply ...

SmartGlance for iPad for iPad on the iTunes App Store
Read reviews, get customer ratings, see screenshots, and learn more about SmartGlance for iPad on the App Store. Download SmartGlance for iPad ...

Chaitanya Pandit (@chaitanyapandit) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Data source - Wikipedia, the free encyclopedia
... Data source A data source is any of the following types of sources for (mostly) digitized data: a database in the Java software platform, datasource ...

2ndQuadrant - PostgreSQL expertise from specialists with a source code level understanding of RDBMS ...
PostgreSQL expertise from specialists with a source code level understanding of RDBMS PostgreSQL Planets Gabriele’s PlanetPostgreSQL Gianni’s ...

Tagged entries for CLOUD COMPUTING
Alan Williamson's output as a Java Champion, Blog-City Architect, BlueDragon Creator, Author, Speaker and Internet Guru

Private equity deals
... of biometric identity management systems, applications and services. www.crossmatch.com Inverness Graham Investment has acquired DataSource ...

C# C Sharp and Tutorials on C# Friends.com
Learn the c# langauge to build web applications using our online tutorials with live demos. Participate in our forums and learn from others. ...

JavaScript UI Library, Ajax Components & HTML5 Framework - DHTMLX
DHTMLX offers a rich JavaScript library, UI components & HTML5 mobile framework. Build impressive web apps for both desktop and mobile devices. ...

Resources last updated: 1/18/2016 5:18:02 PM