I have a master table relationship, i.e. depending on what is selected in the dropdown list the grid show the relevant data.In the database there are several identical entries for the Position field, for instance there are four marketing managers that have different name. How can i group the identical Position name in the dropdown and when selected the grid should display all marketing managers. Here is the code:
I'm designing a web page with two dropdownlists, one for the Make of a car, the other for the Model, both bound to a database with separate SQLDataSources, and using a distinct statement. I add "All" at the top of both by setting appendDataBoundItems = true and adding items named all. Then when I fill the Make with a querystring all the model items get added twice (but only the databound items).Here's my code:
<asp:DropDownList ID="DropDownMake" runat="server" DataSourceID="SqlMakes" DataTextField="Make" DataValueField="Make" AppendDataBoundItems="True" EnableViewState="False" AutoPostBack="True"> <asp:ListItem Selected="True" Value="All">All</asp:ListItem> </asp:DropDownList> <asp:DropDownList ID="DropDownModel" runat="server" AppendDataBoundItems="True" AutoPostBack="True" DataSourceID="SqlModels" DataTextField="Model" DataValueField="Model" EnableViewState="False"> <asp:ListItem>All</asp:ListItem> </asp:DropDownList> <asp:SqlDataSource ID="SqlMakes" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT DISTINCT [Make] FROM [Parts]"> </asp:SqlDataSource> <asp:SqlDataSource ID="SqlModels" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT DISTINCT [Model] FROM [Parts] WHERE ([Make] = @Make)"> <SelectParameters> <asp:ControlParameter ControlID="DropDownMake" Name="Make" PropertyName="SelectedValue" /> </SelectParameters> </asp:SqlDataSource> 'And in the VB file: Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init DropDownMake.SelectedValue = Request.QueryString("Make") DropDownModel.SelectedValue = Request.QueryString("Model") End Sub
If I remove the line "DropDownMake.SelectedValue = Request.QueryString("Make")" it doesnt produce duplicates anymore. What is going on?? I swear I've spent more time developing entire iphone app.
I have house_info table in database and I have dropdownlist in my page that bind it from Shoppingcenter columns from house_info table...
in Shoppingcenter column in some rows are data and some rows are NULL
now when I bind dropdown list it shows space in first Item after that it shows other Item that bind from house_info table I mean in dropdownlist shows NULL value (Space) that is in Shoppingcenter column
below is SP
ALTER procedure [dbo].[selectcentercityS] @city nvarchar(30) ,@region nvarchar(5) ,@district nvarchar(30)
I don't want it shows space in dropdownlist. What should I do?
This is my table ... I am retriving the values of "FROM" and "TO" based on the id .. Separate Dropdownlist for FROM & TO . While Displaying , in "TO" Dropdownlist NY value is repeated twice .. How to remove the duplicate value? need vb coding frnz ...
I have 2 divs with 2 nested divs in them. Let's say div1 contains div11 and div12 and div2 can also contain div11 and div12. I know that this is not normally allowed but I am using jTemplates and they do allow you to print the div11 and div12 twice or more on the same page. The HTML looks like this:
I have a linq statement that retrieves several rows from a stored procedure and maps them to a custom class. The rows returned could contain mulitple instances of the same ID
eg id date total 1 01/01/2011 3 2 01/02/2011 2 3 02/03/2011 5 1 01/01/2011 3
the stored procedure perfoms some complex calculations to return the data How can I remove the duplicate rows in the list ive returned? Ive tried distinct but it doesnt work I want to process the RETURNED list (as there are only 4 rows here, i want to end up with 3) and just have 1 instance of ID 1.
removing duplicate rows from datatable or (dataset) by columnd ID (unique). Below function is working but I would like to edit/adjust the remaing (former) duplicate row's value, not the ID value btw.
ID name sport ------------------------------- 356 John Football 357 Johny Hockey 357 Johny Hockey 358 mike Soccer
ID name sport -------------------------------------------------------------- 356 John Football 357 Johny newFoo Hockey 358 mike Soccer
Public Function RemoveDuplicateRows(ByVal dTable As DataTable, ByVal colName As String) As DataTable
Dim hTable As New Hashtable() Dim duplicateList As New ArrayList() For Each drow__1 As DataRow In dTable.Rows If hTable.Contains(drow__1(colName)) Then duplicateList.Add(drow__1) Else hTable.Add(drow__1(colName), String.Empty) End If Next For Each dRow__2 As DataRow In duplicateList dTable.Rows.Remove(dRow__2) Next Return dTable End Function
How do you avoid duplicate bound items in this scenario: There's a databound control on a page (a DropDownList in this case, though I don't think it matters). It has AppendDataBoundItems set to "true". Somewhere in the code, a DataSource is set and DataBind is called. So this control is bound explicitly. You have a bunch of other things to bind on the page, so you call Page.DataBind.
Your databound control now has duplicate items in it. It was (1) bound explicitly, then (2) Page.DataBind bound it again. Since AppendDataBoundItems was true, the second bind appends to the first, and you end up with double the items. A couple limitations: The explicit call to DataBind on the control is done through some centralized code, and would be painful to change. i really need to bind the rest of the page in aggregate (via Page.Databind()) because there's too many other databound elements to do it individually without writing a ton of individual calls.
I need a method like... Page.DataBindExceptIfTheyHaveAlreadyBeenBoundDuh()
Is it possible to remove an item from the master page when within a content page? so in my example i have a column on left and right which i have created in the master using divs but i want to remove them in a particular page