Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 9th, 2006, 08:54 PM
Authorized User
 
Join Date: Nov 2005
Location: , , Australia.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default Gridview and dropdownlist

Hello

I have a dropdownlist embedded in a gridview, my problem is that when i edit a row and the drop down list appears, the default value is the first value in the list not the value of the record being edited.

I try to get the current value as follows
Protected Sub gEmployee_RowEditing ....
  sStatus = gEmployee.Rows(e.NewEditIndex).Cells(3).Text

  gEmployee.EditIndex = e.NewEditIndex
  Bind_Grid(Sort_Field)
End Sub

and change the displayed value
 Protected Sub gEmployee_PreRender ...
    Dim d As DropDownList
    d = gEmployee.FindControl("eEmpType")
    If Not IsNothing(d) Then
       d.SelectedIndex = d.Items.IndexOf(d.Items.FindByText(sStatus))
    End If
End Sub

But sStatus never gets assigned a value therefore prerender always throws an exception. Can anyone suggest what i am doing wrong.

Thanks

Guy

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Two DropDownList Inside a Gridview ilayaraja ASP.NET 3.5 Basics 3 December 5th, 2008 06:26 PM
DropDownList in Gridview sdoremus ASP.NET 3.5 Basics 0 September 15th, 2008 07:15 PM
Gridview and DropDownList extendedram ASP.NET 2.0 Basics 3 June 12th, 2007 04:05 PM
Binding dropdownlist to gridView mcgarry101 ASP.NET 2.0 Basics 0 February 13th, 2007 07:12 AM
Cascading DropDownList in a GridView Aaron Edwards ASP.NET 2.0 Basics 0 January 12th, 2007 02:11 PM



All times are GMT -4. The time now is 11:44 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.