473,387 Members | 1,516 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,387 software developers and data experts.

Working with ObjectDataSource selected object from codebehind

Hi there,

I quite new to posting in this forum.

I have a problem which I truly hope someone can help me out.

I have a master/detail page - with a gridview displaying company names, and
a DetailsView displaying the selected company from dridview.
I'm able to use the DetailsView to insert and update members of the site
(companies), but I have this problem with a FileUpload, which is bound to a
templatefield in the DetailsView control.

I have created an eventhandler for the DetailsView_ItemInserting in which
I'm validating whether a file was posted.
If the FileUpload contains a file, the filename should be set to a string
vallue, the file should be uploaded to a folder on the site and finally, the
object's property Logo from the DetailsView, should be set to the string
value.

I can upload the file and insert the record, but it doesn't come with the
logo in the database.

My question is now. How do I actually update the DetailsView/ or the
ObjectDataSource so that the logo property will be altedered if there's a
file and the changes are written to the datastore.

My app is build with dataclasses and ObjectDataSources in the presentation
layer and I therefore need a way to update the currently selected object (if
updating) or alter the new object before it's values are written via the
DetailsView back to the ObjectDataSource control.

Thanks in advance!
Feb 1 '06 #1
1 5535
Hi again,

I'm not sure if I made myself completely clear in the first post.

As mentioned, everything with the insert and update works fine, except that
the filename doesn't come with the object back to the ObjectDataSource.

What I would like to do is to determine whether a file was actually posted
through the FileUpload control in the templatefield and if so, attach the
filename to the currently build object in the objectDatasource so that the
filename will be written to the database with the rest of the objects values.
I'm trying to do this from the code behind file.

I'm trying to determine whether a file was posted in the DetailsView
ItemInserting event, and if so, I will propably need to do something else,
maybee in the ObjectDataSource events somewhere.

Anybody have a clue on this?
Feb 1 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: | last post by:
I've defined an ObjectDataSource against a dataset, and I can bind the ObjectDataSource's members to data controls. I'm wondering how to take the values in an ObjectDataSource and...
1
by: John_H | last post by:
Re: ASP.NET 2.0 I would like suggestions or code examples on how to collect a variable length list of input data (item# & item quantity specifically). I thought that I could accomplish this...
2
by: Damon | last post by:
Help! Need this fixed ASAP. I have a GridView/DetailsView master/details form set up, with both bound to separate ObjectDataSource objects. Both the GridView and the DetailsView have a...
0
by: GMartin | last post by:
I have a pop-up form with a three columned Grid that has checkboxes in a Template Column in the first/left-most column. (The form is to allow users to select "Members" of a group, where they check...
0
by: Phillip Ian | last post by:
Tried this over in CSharp.General and didn't get anything, so I thought I'd try again here. If there's an AJAX specific group I could ask this in, please let me know...I did look. I'm trying to...
4
by: Sean | last post by:
I'm dynamically creating PDFs and trying to create an objectdatasource completely in the code behind, but I can't figure out how to call the selected event. Here's what I have so far... string...
0
by: =?Utf-8?B?UGF1bA==?= | last post by:
I have a ListBox server control named "lb_dates" with a SelectionMode of "Multiple". The user can select multiple dates from the listbox. I have ObjectDataSource named "ods_rfq" with a...
0
by: steve | last post by:
I have been fighting with trying to update a GridView for a while. I don't want to use the "built-in" way to do it because I am using business layer methods for updating and deleteing and I don't...
0
by: fig000 | last post by:
Hi, I'm using an objectdatasource. The insert procedure called by the objectdatasource is in a separate library file outside of the aspx and the codebehind that is using the objectdatasource in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.