473,406 Members | 2,369 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Gridview Edit Event

In gridview edit event it is possible to display dropdownlist instead of text boxes.I am using dotnet 2005.

Here the gridview autogenerate columns are false.
And I had only one row and columns are dependent on database rows.
Nov 7 '08 #1
1 1116
Yes, you can set DropDownLists in the EditTemplate of the Gridview in Design Mode.

Expand|Select|Wrap|Line Numbers
  1. <asp:TemplateField HeaderText="Saleperson" SortExpression="SP_NAME">
  2.     <ItemTemplate>
  3.           <asp:Label ID="ITEM" runat="server" Text='<%#EVAL("ITEM")%>'></asp:Label>
  4.   </ItemTemplate>
  5.     <EditItemTemplate>
  6.            <asp:DropDownList ID="ddlSalesmanEdit" runat="server" />
  7.     </EditItemTemplate>
  8. </asp:TemplateField>
  9.  
Once you've added the DropDownList in your EditItemTemplate, you can simply populate it during the RowDataBound Event.

Expand|Select|Wrap|Line Numbers
  1.  Protected Sub gvwTickets_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvwTickets.RowDataBound
  2.         If e.Row.RowType = DataControlRowType.DataRow And e.Row.RowIndex = gvwTickets.EditIndex Then
  3.             e.Row.RowState = DataControlRowState.Edit
  4.  
  5.             'POPULATE DROPDOWNLIST
  6. End if
  7.  
  8.  
Nov 7 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: misiek | last post by:
Hi all. I have following problem: 1. In my web page I have a GridView control, which does not have a DataSourceId set in designer. 2. When user presses Start button then I create...
2
by: luisxx | last post by:
WinSrv2003 SP1 IIS 6.0 ASP.NET C#, 2.0 SQL 2005 All on same machine Hello everyone! I have a method in ASP.NET 2.0 that I can't seem to get right, Gridview1_rowcommand.
4
by: Chris Davoli | last post by:
I've got two questions on how to do things in the new GridView. I'm used to the DataGrid in ASP 1.1, so I need the equavalent in ASP 2.0 Gridview. 1.) What is the equavalent for Item Command...
5
by: maurban | last post by:
Hi there experts, I have a gridview with a couple textboxes and a dropdownlist. I'm trying to insert a default value into my database driven dropdownlist. I'm doing this in the rowdatabound...
1
by: Evan M. | last post by:
Here's my GridView and my SqlDataSource <asp:GridView ID="ContactHistoryGrid" runat="server" AutoGenerateColumns="False" DataSourceID="ContactHistoryDS" DataKeyNames="JobHistoryID"...
4
by: mohaaron | last post by:
This seems like it should be simple to do but for some reason I have been unable to make it work. I would like to databind a SqlDataSource to a GridView during the click event of a button. This...
2
by: DC | last post by:
Hi, I am using a GridView to present data in a DataTable, which I store only in ViewState and when the user hits the "OK" button the rows in the DataTable will be used to execute transactions. ...
11
by: SAL | last post by:
Hello, I have a Gridview control (.net 2.0) that I'm having trouble getting the Update button to fire any kind of event or preforming the update. The datatable is based on a join so I don't know...
2
by: =?Utf-8?B?VGltIFRhZmZsaW5nZXI=?= | last post by:
I've created a DAL and can use the methods to load and manipulate data in a gridview when it is bound to an objectdatasource. But I've been told with a DAL I don't need an objectdatasource at all...
0
by: =?Utf-8?B?ZWdzZGFy?= | last post by:
Hi, I have created a second gridview when customer clicks on select link with this code: Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.