Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 9th, 2010, 03:32 PM
Authorized User
Points: 395, Level: 6
Points: 395, Level: 6 Points: 395, Level: 6 Points: 395, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: May 2007
Location: London, , United Kingdom.
Posts: 73
Thanks: 4
Thanked 0 Times in 0 Posts
Default update dropdown value in db

I want to update when someone click on UPDATE button. But for somereason its not updating.

            <asp:TemplateField HeaderText="Gender">
                   <asp:Label ID="lblGender" runat="server" Text='<%# Bind("Gender") %>'></asp:Label>
                 <asp:DropDownList ID="DdlGender" runat="server" SelectedValue ='<%# Bind("Gender")%>'>
                        <asp:ListItem Value="M" Text="Male"></asp:ListItem>
                        <asp:ListItem Value="F" Text="Female"></asp:ListItem>
    Protected Sub GV_ApproveNomination_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GV_ApproveNomination.RowUpdating

        Dim dl As DropDownList = DirectCast(GV_ApproveNomination.Rows(e.RowIndex).FindControl("DdlGender"), DropDownList)
        e.NewValues("Gender") = dl.SelectedValue

    End Sub
And my sql query is:

SelectCommand="SELECT [ContestantID], [iNominatorEmail], RTrim(ltrim([iGender])) as Gender  FROM [mydb].[dbo].[abc_tblxyz]"

Last edited by Sheraz Khan; June 10th, 2010 at 05:54 AM..
Reply With Quote

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
Dropdown in update panel deb1980 ASP.NET 2.0 Professional 0 June 16th, 2009 06:42 AM
Using a dropdown box in a GridView - How do I update the record with the dd's value? RushNP774 ASP.NET 3.5 Basics 14 March 15th, 2009 02:57 AM
Displaying values in dropdown list from mysql db scoobie Beginning PHP 3 January 25th, 2005 12:09 PM
Can't update DB Help!!! dekel78 Classic ASP Databases 1 August 13th, 2004 01:27 PM
update dropdown values mateenmohd SQL Server 2000 0 October 9th, 2003 03:23 AM

All times are GMT -4. The time now is 04:52 PM.

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