Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Update from gridView ItemTemplate

Reply
Thread Tools

Update from gridView ItemTemplate

 
 
DavidC
Guest
Posts: n/a
 
      06-09-2010
I have a simple GridView with multiple columns from a Sql table. I have only
1 data column that I want to update (a date column) without having to have
the user click an Edit button, edit the date and click the update button. I
have the GridView wrapped in an UpdatePanel and have the code below in the
TextChanged event of the TextBox. I think it may work if I can get the key
value of the row I am on. Any help is appreciated. Thanks.

Protected Sub txtCompleteDate_TextChanged(ByVal sender As Object, ByVal
e As System.EventArgs)
Dim intKey As Int32 = 0

Dim tb As TextBox = CType(sender, TextBox)
Dim dtNewDate As Date = Convert.ToDateTime(tb.Text)
Using conData As SqlConnection = New
SqlConnection(DBClass.GetCoreConnectionString)
conData.Open()
Dim strSQL As String = "UPDATE dbo.ApplicantRequirements" & _
" SET CompleteDate='" &
dtNewDate.ToShortDateString & "'" & _
" WHERE ApplicantReqID = " & intKey.ToString
End Using

End Sub
--
David
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Update from gridView ItemTemplate Enricko Chivaldory ASP .Net 0 07-17-2010 10:45 PM
SqlDataSource param in ItemTemplate can't find GridView bound cont =?Utf-8?B?RGFiYmxlcg==?= ASP .Net 2 04-12-2006 02:44 AM
use data from second sqldatasource in gridview itemtemplate? =?Utf-8?B?RGFiYmxlcg==?= ASP .Net 4 03-21-2006 06:36 AM
How to identify which row to be selected in itemtemplate column under gridview? ABC ASP .Net 1 10-07-2005 06:12 AM
can code inside a Repeater's ItemTemplate modify controls in the ItemTemplate? Bennett Haselton ASP .Net 1 09-24-2004 01:59 AM



Advertisments