Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
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
Old July 21st, 2007, 11:21 PM
Friend of Wrox
Join Date: Jul 2006
Posts: 238
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to rsearing
Default Programatically Change Paramet Of ObjectDataSource

I have a GridView that points to an ObjectDataSource.
This ObjectDataSource's update method is:

Public Shared Function Upsert(ByVal myPaintingType As PaintingType) As Integer
    Return PaintingTypeDB.Save(myPaintingType)
End Function

Where myPaintingType is, obviously, my own object that has one field called "url".

My problem is that I have chnaged the "URL" column of the Gridview to a template so that I can change the "editItemTemplate" of URL to have a FileUpload control. I cannot figure out how to programatically change the "url" property of my object to the filename of the fileupload.

(Typically, you would have a textbox that "Binds" to the URL value--but I am deleting the textbox and putting the fileupload)

I have created a "Sub" in the codebehind of the page to try to capture the Gridview1 updating or the ObjectDataSOurce updating functions..but I don't know how to take the filename from the fileupload and put into the object that is being passed to the update method of my business layer.

Please help.

Kind Regards,

Old July 22nd, 2007, 08:08 AM
Friend of Wrox
Join Date: Jul 2006
Posts: 238
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to rsearing

I figured it out.

I was tying into the wrong event. I was trying to tie into the ObjectDataSource updating. Well, If you put the following in the GridView's rowupdating--works perfectly...I was able to programatically change the value of my object.

Dim url As String = myFileUpload.FileName
e.NewValues("url") = url


Similar Threads
Thread Thread Starter Forum Replies Last Post
ObjectDataSource in UserControl Colonel Angus .NET Framework 2.0 0 April 3rd, 2008 10:14 AM
Problem with ObjectDataSource miguel.ossa ASP.NET 2.0 Professional 1 February 9th, 2008 08:37 AM
CH5 ObjectDataSource nabeelalkaff BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 March 8th, 2007 01:19 PM
Formview with ObjectDataSource rturner003 ASP.NET 2.0 Professional 3 November 1st, 2006 06:17 AM
ObjectDataSource and Wildcards pipelineconsulting ASP.NET 2.0 Professional 1 October 19th, 2006 09:08 PM

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