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


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

C# - Create Editable Dropdown List With Dictionary Option Using JavaScript?

Mar 4, 2010

Eg:-- When I type "A" all the elements starting with A should be displayed... If "B" then elements with B....etc)

Ex:

<asp:DropDownList ID="ddlLocation" style="width:140px" runat="server">
<asp:ListItem Value="1" >India</asp:ListItem>
<asp:ListItem Value="2" >India - Hyderabad</asp:ListItem>
<asp:ListItem Value="3">South Africa</asp:ListItem>
<asp:ListItem Value="4">Australia</asp:ListItem>
</asp:DropDownList>

javascript :

function DisplayText()
{
var textboxId = '<% = txtText.ClientID %>';
var dropdownListId = '<% = ddlLocation.ClientID %>';
document.getElementById(textboxId).value = document.getElementById(dropdownListId).value;
document.getElementById(textboxId).focus();
}

code behind :

ddlLocation.Attributes.Add("onChange", "DisplayText();");

View 1 Replies

Forms Data Controls :: Editable Drop Down List Within ListView?

Jun 15, 2010

I have a ListView that contains a lot of editable items. Every item has some values, like; item name, item price, item size and so forth. I would like to add another editable column which should be a drop down list. This should list which sizes the item is available at, like S, M, L, XL. Some item are only available in S and M, while other items may just have a standard size (meaning none of the above sizes). So for example if you are to add an item called polo shirt and its only available in sizes L and XL then you should be able to do that. And then at the front-end where the users surf the items it should be like that when a users sees this Polo shirt he should be presented with a drop down list where he is only able to select L and XL

I can't figure out how to implement this in the Listview and the database. I have mentioned that I want a drop down list to appear in the back-end, this is not a necessity, anything will do as long as the front-end is showing a drop down list with the choosen sizes.

View 10 Replies

Forms Data Controls :: Editable Gridviews - Updating Rows Not Editable / Bound

Jun 30, 2010

Note: Code is taken from this tutorial [URL] I currently have an editable gridview with only some columns editable by the user. In the background I want to record the time/date they have saved the data to the grid. This column 'Time' is not bound to the grid. Is there anyway I can still include this update when rebinding the newly edited data?

I'm also having a problem saving the updated data of my column ActivityTotal. I've been debugging that and following the variable, and it holds the correct value, but just doesnt seem to update. I am providing the codes below for both my gridview and the cs behind and would be grateful if someone could take a look, I assume it's a sort of minor sql issue on my part.

code

protected void UpdateButton_Click(object sender, EventArgs e) { originalDataTable = (DataTable)ViewState["originalValuesDataTable"]; foreach (GridViewRow r in GridView_ABC.Rows) if (IsRowModified(r)) { GridView_ABC.UpdateRow(r.RowIndex, false); } // Rebind the Grid to repopulate the original values table. tableCopied = false; GridView_ABC.DataBind(); }

View 4 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

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 :: 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

Forms Data Controls :: Map Nullable Foreign Key To Dropdown List?

Apr 12, 2010

I have dropdownlist that maps from a SQL foreign key, which can be NULL.

Currently, I've added a "Please select..." to the top of my dropdown list and assigned it a value of 0.

I know how to map from the drop down list to SQL using a CASE statement in my UpdateCommand.

But how to I map from the SELECT statement to my dropdownlist? If this foreign key contains null I get "Item not in Dropdown list". I'd like to show "Please Select..." as the dropdownlist item if the SQL item contains NULL. I saw something online that says to use the value '''' for 'Please select...', but I don't think it's right, plus it doesn't work.

Do I have to do something in my SELECT statement or do I have to do something on DDL.Databind?

View 3 Replies

Forms Data Controls :: Dropdown List Within A FormView Error?

Jun 29, 2010

I have a formview and within it I have a dropdown list which brings back a list of value from my database,

View 2 Replies







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