Forms Data Controls :: Taking Care Of Duplicates In A Dropdown List?

Mar 22, 2011

I have query that returns a line that looks like this belowA NEWYORK PROGRAM AA NEWYORK PROGRAM Bnow, the NEWYORK is inputted into a dropdownlist and the program A and program B is inputted into a dropdownlist as wellI am using utility.ControlTools.SetListControl for my dropdownlist. I would like a situation where my dropdownlist only contains one NEWYORK instead of two and my dropdownlist for programs to contain Program A and program B. Can this be done.

View 2 Replies


Similar Messages:

Forms Data Controls :: 2 Dropdown List / "Displaying A Dropdown List Of Categories With A --None -- Option?

Oct 10, 2010

I am stuck at this point "Displaying a dropdown list of Categories with a --None -- Option. I want the gridview control to display 2 dropdown list one in read-only mode and the other in edit mode. When a record is in read-only mode, the dropdownlist's enabled property will be set to false."When it's on a read-only mode, it doesn't display the selected Category. it shows but the "No Category". When i click on edit to edit or change category, it doesn't display the selected category.

The example is given below( I am reading the book Sams Teach yourself ASP.NET 2.0 by Scott Mitchell. page 628)

<asp:Label ID="UserIdValue" runat="server" Visible="False"></asp:Label>
<asp:SqlDataSource ID="picturesDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [Pictures] WHERE ([UserId] = @UserId) ORDER BY [UploadedOn] DESC"
DeleteCommand="DELETE FROM [Pictures] WHERE [PictureID] = @PictureID"
InsertCommand="INSERT INTO [Pictures] ([UserId], [CategoryID], [Title], [Description], [UploadedOn]) VALUES (@UserId, @CategoryID, @Title, @Description, @UploadedOn)"
UpdateCommand="UPDATE [Pictures] SET [UserId] = @UserId, [CategoryID] = @CategoryID, [Title] = @Title, [Description] = @Description, [UploadedOn] = @UploadedOn WHERE [PictureID] = @PictureID">
<DeleteParameters>
<asp:Parameter Name="PictureID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="UserId" />
<asp:Parameter Name="CategoryID" Type="Int32" />
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="UploadedOn" Type="DateTime" />
</InsertParameters>
<SelectParameters>
<asp:ControlParameter ControlID="UserIdValue" Name="UserId" PropertyName="Text"/>
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="UserId"/>
<asp:Parameter Name="CategoryID" Type="Int32" />
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="UploadedOn" Type="DateTime" />
<asp:Parameter Name="PictureID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
<br />
<asp:SqlDataSource ID="categoriesDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [CategoryID], [Name] FROM [Categories] WHERE ([UserId] = @UserId)">
<SelectParameters>
<asp:ControlParameter ControlID="UserIdValue" Name="UserId" PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<asp:SqlDataSource ID="maxPictureIDDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT MAX(PictureID)
FROM Pictures
WHERE UserId = @UserId">
<SelectParameters>
<asp:ControlParameter ControlID="UserIdValue" Name="UserId"
PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<asp:Label ID="cannotUploadImageMessage" runat="server"
Text="The photo could not be added to your album either because you did not specify a file to upload or the file specified was not a JPEG image with the file extension .JPG"></asp:Label>
<br />
<asp:DetailsView ID="dvPictureInsert" runat="server"
DataSourceID="PicturesDataSource" Height="50px" Width="125px"
AutoGenerateRows="False" CellPadding="4" DataKeyNames="PictureID"
DefaultMode="Insert" ForeColor="#333333" GridLines="None">
<AlternatingRowStyle BackColor="White" />
<CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
<EditRowStyle BackColor="#2461BF" />
<FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
<Fields>
<asp:TemplateField HeaderText="Picture">
<InsertItemTemplate>
<asp:FileUpload ID="imageUpload" runat="server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="imageUpload" Display="Dynamic"
ErrorMessage="There was no file selected" ValidationGroup="PictureAdd"></asp:RequiredFieldValidator>
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Category" SortExpression="CategoryID">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("CategoryID") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:DropDownList ID="pictureCategory" DataSourceID="categoriesDataSource"
runat="server" DataTextField="Name" DataValueField="CategoryID"
SelectedValue='<%# Bind("CategoryID") %>'
Visible='<%# Bind("CategoryID") %>' AppendDataBoundItems="True">
<asp:ListItem Selected="True" Value="">-- Select Category --</asp:ListItem>
</asp:DropDownList>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("CategoryID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Title" SortExpression="Title">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Title") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Title") %>'></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox1" Display="Dynamic"
ErrorMessage="you must provide a name for the title"
ValidationGroup="PictureAdd"></asp:RequiredFieldValidator>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("Title") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Description" SortExpression="Description">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Description") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Description") %>'

View 2 Replies

Forms Data Controls :: Drop Down List Not Taking The Selected Value?

Jan 19, 2010

I'm using vs2008 and add a dropdown list in my page. Default value of this control is "Digital". When I select another value from the list and press a button, next time the page displaying the same value, i.e Digital, not the selected value. I just want to show the selected value on the page.

View 2 Replies

Forms Data Controls :: Ajax In Asp 1.1 / Taking Too Much Refresh And Taking Long Time?

Jan 13, 2010

I am making some application in asp.net 1.1 in that I am displaying data in datagrid from database. In data grid first column is of check box and radio button and in the last column we have text box now thing is that when i click on check box crosponding textbox we fill some figure and at the end we press calculate button to get total. After getting total we have to press continue button to go next step

But suppose if some body remove that check the we should press calculate button or chnage some figure in the text box then we should press calculate button again to recalculate. for that i kept autopost back on check box oncheckedchanged event and text box ontextchanged event and hide continue button so user will click calcutae button abd then continue button will re-apper

Problem it that it taking too much refresh and taking long time. So was lloking for some ajax method to use in my application.

View 8 Replies

Forms Data Controls :: Databound Dropdown List / Shows First Value In List Rather Than Current Value?

Jan 17, 2011

I have a databound dropdownlist and have a problem with the default value it selects.When I attempt to edit a record the dropdownlist shows the first value in the list rather than the current value. I want the dropdown list to display the current value.

I'm sure this is very simple but I'm very new to ASP.NET.

I'm using .NET version 4.

View 4 Replies

Web Forms :: Remove Duplicates From List Method?

Nov 16, 2010

I have a Method that returns 4 records like this.

Name: Test1
Year: 2010
Value: $1000

Name: Test2
Year: 2010
Value: $1000

Name: Test3
Year: 2011
Value: $2000

Name: Test4
Year: 2011
Value: $1000

I need a way to get the unique years just ( 2010, 2011) rather than all 4 years, rest of the data could be duplicates.

Here is the method:

public List<TestCosts> GetTestvalues(string testid)
{
List<TestCosts> testlist = Testscores.List(testid);
return testlist;
}

Most of the examples of removing duplicates I saw have a list of one item only but in my case I have 3 items per record and I need to loop through each record, find the duplicate years, remove them and then return the distinct list of years along with the other data.

View 1 Replies

C# - Bind The Values Without Duplicates From Database Into Dropdown Using LINQ?

Apr 2, 2011

I have a small issue binding the values into a dropdown using LINQ in ASP.NET code-behind.

var clientquer = from i in Entity.New_Bank select i;
//var q = (from s in names
// select s).Distinct();
// var getlendername = (from db in mortgageentity.New_Lender group db by db.Bank_Name into t select t.Key).ToList();
if (clientquer.Count() > 0)
{
ddlbankname.DataSource = clientquer.ToList();
ddlbankname.DataValueField = "Bank_ID2";
ddlbankname.DataTextField = "Bank_Name";
ddlbankname.DataBind();
}

It is binding with duplicate values, but I don't want bind duplicate values. I'm trying to solve this by using a group by clause, but it is not working.

View 2 Replies

Forms Data Controls :: Use Dropdown List With Objectdatasource

Aug 13, 2010

I will try to keep the question short:

1. I am new to ASP and I can not get this to work:

2. I am Using a <asp:DropDownList in a <InsertItemTemplate> in a <asp:ListView

3. The dropdownlist during insert does not get polulated (it is empty) while the same construction and same datasource works in the edittemplate: <asp:DropDownList in a <EditTemplate> in a <asp:ListView

4. I noticed that filling the dropdownlist with a <asp:ListItem works; the insert list is populated. (not usable for me) In both cases I use the same datasource from the code behind like this : Edit:

<asp:DropDownList ID="DropDownStartday" runat="server" SelectedValue='<%# Bind("startday") %>'
DataSource="<%# GetDataSourceStartDay() %>" DataValueField="daynum" DataTextField="dayname"
Insert: (with or without Selectedvalue: NoJoy)
<asp:DropDownList ID="DropDownStartday" runat="server"
DataSource="<%# GetDataSourceStartDay() %>" DataValueField="daynum" DataTextField="dayname"

View 4 Replies

Forms Data Controls :: Add Dropdown List To Gridview?

May 11, 2010

I have a gridview with edit and save buttons.

code

<asp:TemplateField
HeaderText="Job Title"
SortExpression="Job Title">

[Code]....

The above code is not working what should I change to make it work?

View 3 Replies

Forms Data Controls :: Editable Dropdown List

Mar 9, 2011

can i enter a choice that is not in the dropdown list? Just like a combo box, there is a list of item but a user can still have an option to enter in the textbox. does a dropdown list also have this function? or if not is there a workaround?

View 3 Replies

Forms Data Controls :: How To Load The Dropdown List In The Gridview

May 18, 2010

i would like to know how to load the dropdown list in the Gridview edit with the dropdown list values from the database

View 3 Replies

Forms Data Controls :: Access Dropdown Value Of Each List Item?

Dec 3, 2010

I want to access a dropdown control value of each list item as soon as it is created. I tried with ItemCreated and ItemDataBound events but I am getting null contro when I try to access control as shown below:

ListViewDataItem item = (ListViewDataItem)e.Item;
int LstIndex = item.DataItemIndex;
RadComboBox ddlCategory = (RadComboBox)(listView1.Items[LstIndex].FindControl("rdComboCategory"));

Also, I get listview.item.count zero. IS there any event where I will get listitem count and list items?

View 4 Replies

Forms Data Controls :: Add Value In A Dynamically Created Dropdown List?

Jan 11, 2010

I have a database with some data in. Now I'm trying to show that data on my page whit a ListView.

For each object from the database a ListView will generate a dropdownlist.

I also have a DataPager on my page and this is where the problem occurs.

Each object generated from the database has a field that may look like this example.: 1,2,3.

In my code now I´m trying to split this string of comma character and add new items to my dropdownlist.

This works as long as I do not have DataPager on. But if I choose to view an x number of pages at the time when the page loads, I have value in the dropdownlists, only on my first page.

A piece of my code:

[Code]....

View 2 Replies

Forms Data Controls :: Set For DropDown List Inside GridView

Nov 16, 2010

How do i set a data source of a drop down list which is inside a grid view, snap shot of asp code given below , the Asp file name is DataEntry.aspx and there is method in the DataEntry.aspx.cs called DTB.BindData("Department"). i want to set the datasource to point to this method

<asp:GridView ID="GridViewEmply" DataKeyNames="EmployeeID" runat="server"
AutoGenerateEditButton="True" ShowFooter="True"
OnRowEditing = "GridViewEmply_RowEdit" OnRowCancelingEdit = "GridViewEmply_RowCancelingEdit"
OnRowUpdating = "GridViewEmply_RowUpdating" OnRowCommand = "GridViewEmply_RowCommand"
OnPageIndexChanging="GridViewEmply_PageIndexChanging"
AllowSorting="True" AutoGenerateColumns="False" AllowPaging="True" Visible="false">
<Columns>
<asp:TemplateField HeaderText="DepartmentName">
<ItemTemplate>
<asp:Label ID="LabelEmplyDeptName" Text='<%# Eval("DepartmentName") %>' runat="server"></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="ddlDept" runat="server" >
</asp:DropDownList>
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

View 3 Replies

Forms Data Controls :: Getting The Selected Values From A Dropdown List

Jan 25, 2011

I have created a dynamic dropdownlist. I need to get the selected values from the dynamic list and store it my sql database.

View 5 Replies

Forms Data Controls :: Cant Access DropDown List's First Entry

Dec 7, 2010

my C# web application contain accessing of database on the basis of datas selected from a dropdown list.. and my pblm is i cant access the first entry from the dropdown, dropdown list contains different dates,when user select one date from dropdown it will redirect to another page.. the page shows details from database on the basis of this particular date.....my C# dropdown's selected index changed code is shown below:-

[Code]....

and HTML code corresponding to this is:-

[Code]....

i cant access the first data from dropdwn,even it cant redirect to target page.. other entries (the 2nd 3rd entrie etc) was accessible and it shows the details from database on the basis of that corresponding value(usually some date).

View 4 Replies

Forms Data Controls :: Keeping The Last Selected Value In A Dropdown List?

Dec 30, 2010

I have a small problem with drop down list. I have a aspx page which shows the information of a customer and there is an Edit button, which will take the customer to the edit information page. On the edit information page, I have drop down lists and I want the selected value in the drop down list to have the current value of the current customer on Page Load event.

View 4 Replies

Forms Data Controls :: How To Get The Foreign Key Values In DropDown List

Jun 12, 2010

I'm using objectDataSource and Formview. Currently I'm using a Text-Box to put the CategoryID.

I want to display the Category-Name instead of Category ID in Drop Down list.

View 4 Replies

Forms Data Controls :: Add Dropdown List To Gridview Edit

Apr 16, 2010

I have packed the access 2007 project management database and moved it to SQL Server. I'm aware that SQL doesn't populate dropdown lists for the Status and completion Percentage columns. I have to have this done by April 21 and my professor is just now telling me he won't accept the textbox inputs due to data integrity and I don't have time to rebuild this entire site.

View 3 Replies

Forms Data Controls :: Populate A Dropdown List With Web.config?

Feb 18, 2010

I normally have a function to populate my dropdown list with the database values.

How can I populate a dropdown list so the values are stored in the web config?

The only problem is that the list would need to store two values, the text value of the combo, and the data value.

View 4 Replies

Forms Data Controls :: Bind Two Datasources To One Dropdown List?

Jan 7, 2010

Is it possible to bind two separated datasources to one dropdown list such that they are both alphabetically sorted and seprated by some sort of line. I know there is a way to insert elemets manually, but I'm not sure of the 2 separate datasources. I've serached this forum and while there were several posts none of them offered any workable solution.

View 5 Replies

Forms Data Controls :: Hiding Page Dropdown List?

Dec 30, 2010

I would like to ask a question about hiding a drop down in my gridview. I have a gridview and I have a drop down list to control the page size of that gridview. when there is data in that gridview, it is fine for user to see the drop down list. But when there are records in the gridview, I do not want the user to see this drop down list. How can I hide it when there is no data?

View 2 Replies

Forms Data Controls :: Getting Dropdown List Values In Codebehind (c#)?

Jan 18, 2011

in my proj i have a grid view which consists of name and droppown list as shown below:

<asp:GridView ID="gvJobs" runat="server" AllowPaging="true" AllowSorting="true" AutoGenerateColumns="False" OnRowDataBound="gvJob_RowDataBound" OnRowCommand="gvJobs_RowCommand" >
<Columns>
<asp:TemplateField HeaderText="Jobs" SortExpression="name" HeaderStyle-HorizontalAlign="Left">

[Code]....

when i click the dropdown list it is postbacking(since i made auto postback=true). on that time i am unable to get the selected value from dropdown list.

View 3 Replies

Forms Data Controls :: Adding To Dropdown List During Run Time

Sep 27, 2010

I am trying to do is user can add to the drop down list during runtime and that new value should then be inserted in the databse .

suppose drop down list is bind with as dataset with values

value1,

value2 ,

value3 ,

now if the user click on button "add new items" then he should be able to enter new list item and that should be able to insert it in databse.

View 1 Replies

Forms Data Controls :: Get Selected Value From Dropdown List In A Repeater?

Jun 14, 2010

I'm doing property booking based project.

I have repeater control for search results.

For every search result I create a dropdown list with 2 month booking overview.

<ddl>
<item value = "1"> January - February </item>
<item value = "2"> February - March </item>

etc.

Then I call function to generate 2 months calendar view, which has two parameters generate(startmonth as Integer, sku as string)

Everything works when I hardcode starmonth as some integer.

I spent all day with no progress on how to pass value. I need a guide. I guess second problem will be to restore changed dropdown values on Postback, but one step at a time.

But what I want to do, to pass selected item value, to function, that would change view for property associated with this dropdown.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved