Forms Data Controls :: Dropdown List To Boolean Data In Gridview?

Mar 24, 2011

I have a boolean gender value in my database. via a linqdatasource I would like to display this in a gridview template.

In the Edit template I would like to use a dropdownlist with male and Female listitems. But how should I bind this to my boolean data value?

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 :: 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 :: 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 :: 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 :: Connect A Dropdown List To A Gridview?

Apr 3, 2010

i have a drop down list that will be used to filter a datatable, i would like to populate the ddl datasource from Unique values from the datatable for the grid.

Is it possible to SELECT from the grid datatable 2 columns with unique vals? like Select custId, CustName groupby custId, CustName ?

View 2 Replies

Forms Data Controls :: Dropdown List In Gridview Edit Mode?

Jan 10, 2011

I have a Members table with the following fields: LastName, FirstName, Address, CityID, ProvinceID, PostalCode.

I have added another field for the MemberTitleID.

During the Gridview Edit mode, I am trying to enable setting the MemberTitle using a drop-down list as shown below:

[Code]....

When I added the new field MemberTitleID in the Members Table, all of them were left un-initialized.

Here is the error I get when I click the edit button on the grid view :

[Code]....

[Code]....

View 1 Replies

Forms Data Controls :: How To Get The Textbox And Dropdown List Values In To Gridview

Jul 16, 2010

i have 4 text boxes and 2 dropdowns are there when ever i fill it all values should place in grid view., after entering of 5 or 6 records, i click on SAVE button then ,i want to save those values in to Data Base ,which are at Grid view.....

Example:

[code]...

View 4 Replies

Forms Data Controls :: Handling Dropdown List In A Gridview For EditItemTemplate?

Feb 26, 2010

I have a gridview and I do Add, Modify and Delete operations. I am comfortable adding and modifying any text or date value. Now, I have a dropdown list to be displayed. I need to add and modify. The contents in the dropdownlist is fixed. Below is the code. I know there is a problem in my

<EditItemTemplate>
<asp:TemplateField
HeaderText="Leave Type">
<EditItemTemplate>
<asp:DropDownList

[Code]....

What is that I need to have code for EditItemTemplate

View 1 Replies

Forms Data Controls :: Bind Dropdown List In Gridview(without Using Asp.listitem)?

Jan 17, 2011

How to bind dropdown list in Gridview(without using asp.listitem)

View 4 Replies

Forms Data Controls :: Dropdown List Bind With Database Inside Gridview

May 30, 2010

I have created an asp.net customizable gridview where user will be able to add and delete data. Now I face some proplem with this gridview. now I want to add a dropdown list (which is dynamically bind with database) inside the grid. I created code and it bind well. when the page is post back previous selected dropdown list value lose and set to selectedIndex=0; For this reason I used if(!page.Ispostback) and put the dropdown binding code inside this. Here I faced a problem. The problem is when I want to add data inside grid the dropdownlist missin bind. How can I overcome this problem? For your kind observation I given entire code below:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
CellPadding="4" ForeColor="#333333" GridLines="None"
onrowdeleting="GridView1_RowDeleting"
onrowdatabound="GridView1_RowDataBound">
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:TemplateField HeaderText="SL">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("RowNumber") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("RowNumber") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Material">
<ItemTemplate>
<asp:DropDownList ID="drpMaterial" runat="server">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Quantity">
<ItemTemplate>
<asp:TextBox ID="txtQuantity" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txtQuantity" ErrorMessage="Required Field Missing">*</asp:RequiredFieldValidator>
</ItemTemplate>
</asp:TemplateField>...............................

View 8 Replies

Forms Data Controls :: Display Gridview Based On Dropdown List Selection?

Feb 21, 2010

I'm having trouble figuring out how to display a gridview based on the selection of a drop down list. I manually entered the drop down list items, but in the configure/choose data source I don't understand how you make a relationship between each list item and the corresponding database table you want to show.

View 7 Replies

Forms Data Controls :: Gridview Edit / Update - Dropdown List Using C# And Sql Server

Jan 27, 2011

Using C# and sql server. I have a gridview which is populated using a sql query. I have 5 columns in the gridview ( projectid,project name,description,date,status). I'm using the Edit/update option that is available in the gridview to edit/update a user selected row. When I use this Text boxes appear. I want to have a drop down list for status instead of a text box with values Started,Inprocess,Complete, Inhold.

View 3 Replies

Forms Data Controls :: Filter Gridview When Selection Is Made From Dropdown List

Apr 24, 2010

I have a Gridview with a parameterized SQLdatasource. I want the Gridview to be filter when the a selection is made from the dropdown list Here is what I have. I am missing something.

<asp:SqlDataSource ID="SqlDSAlbums" runat="server"
ConnectionString="<%$ ConnectionStrings:Default %>"
SelectCommand="SELECT Album.Album, genre.Genre, Band.Band, Album.year, Album.AlbumUID FROM Album INNER JOIN Band ON Album.BandUID = Band.BandUID LEFT OUTER JOIN genre ON Album.GenreUID = genre.GenreUID WHERE (genre.Genre = @Genre) OR (genre.Genre <
'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ') ORDER BY genre.Genre, Band.Band"
ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>">
<SelectParameters>
<asp:ControlParameter ControlID="ddlGenre" Name="Genre"
PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDSGenre" runat="server"
ConnectionString="<%$ ConnectionStrings:Default %>"
SelectCommand="SELECT Genre, GenreUID FROM genre Order by Genre"></asp:SqlDataSource>
Select a Genre
<asp:DropDownList ID="ddlGenre" runat="server" DataSourceID="SqlDSGenre"
DataTextField="Genre" DataValueField="Genre" AppendDataBoundItems="True"
AutoPostBack="True">
</asp:DropDownList>
<asp:GridView ID="gvAlbum" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" DataSourceID="SqlDSAlbums">
<Columns>
<asp:BoundField DataField="Album" HeaderText="Album" SortExpression="Album" />
<asp:BoundField DataField="Genre" HeaderText="Genre" SortExpression="Genre" />
<asp:BoundField DataField="Band" HeaderText="Band" SortExpression="Band" />
<asp:BoundField DataField="year" HeaderText="Year"
SortExpression="year" />
<asp:TemplateField HeaderText="Comments">
<ItemTemplate>
<asp:HyperLink ID="hlToComments" HeaderText="Comments" runat="server" NavigateUrl='<%# String.Format("ViewComments.aspx?AlbumUID={0}", Eval("AlbumUID")) %>' Text="Click Here" />
</ItemTemplate>
</asp:TemplateField>

View 4 Replies

Forms Data Controls :: Order Of The Items In A DropDown List Inside GridView

Sep 22, 2010

I have a DropDownList inside the EditTemplateItem (if the user clicks edit) in a GridView.The DropDownList receives all available rows from the database. My problem is,if the user clicks Edit in the GridView to edit a row and opens the DropDownList Box the original item is not selected but the first one.That means the items are sorted. Have someone an idea how I can solve this issue that the right item / the original is selected if I change to edit mode of the grid view?

View 2 Replies

Forms Data Controls :: Customizing GridView To Display And Edit Boolean Data?

Nov 4, 2010

I'm quite new to ASP.NET programming, so excuse me if my question is dumb.I have the need of showing a grid (A GridView ?) of boolean values. But instead of showing checkboxes, I want to show the cells filled with black (value is true) or white (value is false). I understand I can do that by crafting a TemplateField and changing the style of the cell to select the correct background color and never displaying an actual value. I have not tried but I think it could work. The grid will contains 99% of boolean values and will contain something like 20 rows of 100 columns (2000 cells).

Now I would like to have that grid edited in place at client side, that is with JavaScript, changing the style of the cell when the user clicks on the cell. There would be a submit button somewhere to postback the whole thing.Is that possible ? Any hint for programming it ?Since I have a lot of webforms which needs to display that kind of grid, I would like to go further and design a custom GridView (or other control) that I could install in the toolbox and reuse easily.

View 5 Replies

Forms Data Controls :: Dropdown List In Gridview - Selected Index While Saving The Record

Oct 22, 2010

I am developing page for maintaing employee record using Visual Studio 2008, MS SQL server 2005. I am able to fetch and display all the employee information in gridview, the gridview have the dropdown list to display the employee type [ Part Time, Full Time, Permanent , Contract ], in the item template i am having dropdown list. IN the dropdown list i am displaying this. But While saving the record in gridview the droppdown selected index are changed to 0 of other dropdown list.

the user may be change the dropdown value from permanent to contract, or so. but while click on the save button in gridview, all the previous selection are gone, and always showing the first record of dropdown list. I know this is happening because we are doing dropdown list bind on onRowDataBound.

View 11 Replies

Forms Data Controls :: Select Dropdown List Item In Gridview Edit Mode?

Jun 16, 2010

I have a dropdown list in the edittemplate of a gridview and now it selects the first value that comes from the datasource. How can I get it to select it's original value? Where do I put the code?

View 9 Replies

Forms Data Controls :: GridView Page Reset Based On DropDown List Selection?

Jan 3, 2011

i want to see the sales in the grid view based on the month selected from drop down list. Ex: when I select June 2010 from the ddl box, the sales for that month are correctly displayed in the grid view. I go to page 4 to look at some sales there and then switch the month to August 2010 to see sales for that month instead. Here is the problem. When I switch the month, it show August 2010 sales, but stays in page 4 instead of going back/resetting back to page 1 of August 2010 sales.

How do I reset the grid view page back to the first page of August 2010 sales?

I am fairly new to ASP. If I have missed an imp. detail in this post, let me know and I will get that info. out there.

View 4 Replies

Forms Data Controls :: Eval Doesn't Work In A Dropdown List Inside A Gridview

Nov 7, 2010

I am tring to set the selected value of a dropdown inside a gridview like this:

[Code]....

And I get error:

[Code]....

View 4 Replies

Data Controls :: How To Put Dropdown List In Gridview

Apr 27, 2016

I use gridview in page that use session to fill it below are code:

<asp:GridView runat="server" ID="gvOrders" EmptyDataText="No orderPlaced !" ShowFooter="true" CssClass="gridorder"
AutoGenerateColumns="false" DataKeyNames="Id">
<Columns>

[Code].....

quantity is in databound in gridview and it will show quantity of users order...

now I want in quantity column in gridview I can put Dropdownlist that will fill with numbers that if users want increase their order they can do it from gridview...

View 1 Replies

Forms Data Controls :: How To Update Text Of A Textbox Placed Inside A Gridview (template) By A Dropdown List

Nov 13, 2010

I have a text box placed inside a gridview(template) . I need to update its value by a dropdown list event (Selected Item Changed event) placed in the same gridVew. But The problem is that , I need to update the text box of the same row the dropdown list (whose textChange Event haas been fired)

[code]....

View 1 Replies

Forms Data Controls :: Cascading Dropdown List In A GridView Control In Edit Mode Error

Aug 11, 2010

I'm trying to follow this article on cascading dropdown list in a GridView control in edit mode (except I'm using C#) [URL] I keep getting this error message "ProjectID is neither a DataColumn nor a DataRelation for table DefaultView."

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if ((e.Row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit)
{
DataRowView dv = (DataRowView)e.Row.DataItem;
//// Preselect correct value in Projects list
DropDownList listProjects = (DropDownList)e.Row.FindControl("DropDownList1");
listProjects.SelectedValue = dv["ProjectID"].ToString(); // *****************this is where I get the error *********
// Databind list of categories in dependent drop-down list
DropDownList listCategories = (DropDownList)e.Row.FindControl("DropDownList2");
SqlDataSource dsc = (SqlDataSource)e.Row.FindControl("sdsDDL2");
dsc.SelectParameters["ProjectName"].DefaultValue = dv["ProjectName"].ToString();
listCategories.DataBind();
listCategories.SelectedValue =(dv["CategoryID"].ToString());
}
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%&#36; ConnectionStrings:ttuser %>" SelectCommand="SELECT
TE.TimeEntryID,
P.ProjectName,
CAT.CategoryName,
TE.TimeEntryDescription,
TE.TimeEntryDuration,
TE.TimeEntryDate
FROM dbo.aspnet_starterkits_TimeEntry TE inner join
dbo.aspnet_starterkits_ProjectCategories CAT on
TE.CategoryID=CAT.CategoryID inner join
dbo.aspnet_starterkits_Projects P on
CAT.ProjectID=P.ProjectID
Where TimeEntryUserID=(SELECT UserId FROM dbo.aspnet_Users WHERE
UserName=@UserName) AND
TE.TimeEntryDate=@WeekEnding
" OldValuesParameterFormatString="original_{0}" UpdateCommand="UPDATE dbo.aspnet_starterkits_TimeEntry
SET
TimeEntryDescription=@TimeEntryDescription,
TimeEntryDuration=@TimeEntryDuration,
TimeEntryDate=@TimeEntryDate
WHERE
TimeEntryID=@original_TimeEntryID">
<SelectParameters>
<asp:ControlParameter ControlID="UserList" Name="UserName"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="WeekEnding2" Name="WeekEnding"
PropertyName="Text" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="TimeEntryDescription" />
<asp:Parameter Name="TimeEntryDuration" />
<asp:Parameter Name="TimeEntryDate" />
<asp:Parameter Name="original_TimeEntryID" />
</UpdateParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" BorderWidth="0px"
BorderStyle="None" Width="100%" CellPadding="2" PageSize="25"
DataKeyNames="TimeEntryID" onrowdatabound="GridView1_RowDataBound"
onrowupdating="GridView1_RowUpdating" >
<Columns>
<%--<asp:CommandField ShowEditButton="True" />--%>
<asp:BoundField DataField="TimeEntryID" HeaderText="ID"
SortExpression="TimeEntryID" InsertVisible="False" ReadOnly="True"
ItemStyle-HorizontalAlign="Center" >
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundField>
<asp:TemplateField HeaderText="Project" SortExpression="ProjectName">
<EditItemTemplate>
<asp:DropDownList
ID="DropDownList1"
runat="server"
DataSourceID="sdsDdlProjectsEdit"
DataTextField="ProjectName"
DataValueField="ProjectID"
AutoPostBack="True"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>
<asp:SqlDataSource
ID="sdsDdlProjectsEdit"
runat="server"
ConnectionString="<%&#36; ConnectionStrings:ttuser %>"
SelectCommand="SELECT ProjectID,ProjectName FROM dbo.aspnet_starterkits_Projects">
</asp:SqlDataSource>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("ProjectName") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Category" SortExpression="CategoryName">
<EditItemTemplate>
<asp:DropDownList
ID="DropDownList2"
runat="server"
DataSourceID="sdsDDL2"
DataTextField="CategoryName"
DataValueField="CategoryID">
</asp:DropDownList>
<asp:SqlDataSource
ID="sdsDDL2"
runat="server"
ConnectionString="<%&#36; ConnectionStrings:ttuser %>"
SelectCommand="SELECT CategoryID,CategoryName FROM dbo.aspnet_starterkits_ProjectCategories WHERE ProjectID=@ProjectID">
<SelectParameters>
<asp:Parameter Name="ProjectID" />
</SelectParameters>
</asp:SqlDataSource>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("CategoryName") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:BoundField DataField="TimeEntryDescription" HeaderText="Description"
SortExpression="TimeEntryDescription" ItemStyle-HorizontalAlign="Center" >
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="TimeEntryDuration" HeaderText="Hours"
SortExpression="TimeEntryDuration" ItemStyle-HorizontalAlign="Center" >
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundField>
<asp:BoundField ApplyFormatInEditMode="True" DataField="TimeEntryDate"
DataFormatString="{0:d}" HeaderText="Week Ending"
SortExpression="TimeEntryDate" ItemStyle-HorizontalAlign="Center" >
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundField>
<asp:CommandField ShowEditButton="True" HeaderText="Edit" ButtonType="Image" EditImageUrl="images/icon-edit.gif"
UpdateImageUrl="images/icon-save.gif" CancelImageUrl="images/icon-cancel.gif" />
</Columns>
</asp:GridView>

View 3 Replies

Forms Data Controls :: Dropdown Select Message In Item Template Gridview Dropdwon List?

Sep 18, 2010

I have used gridview item template , which has two dropdown list. The first dropdown list is binded from database to the dropdown list. I have using the below code , to show the select message in dropdown list before selecting any item from dropdown list. In first row its show me --Select-- message and my vaues.. if i select some value form dropdownlist and click add new button it will create a new row dynamic then in previous row again it come back --Select-- message. on going to second row. I need to remain first row user selected value on going to next row. The New row will show --select-- message..

<asp:DropDownList id="DropDonList2" tabIndex=11 runat="server"

View 6 Replies







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