473,548 Members | 2,622 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Working with ObjectDataSourc e 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_Ite mInserting 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
ObjectDataSourc e 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 ObjectDataSourc es 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 ObjectDataSourc e control.

Thanks in advance!
Feb 1 '06 #1
1 5553
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 ObjectDataSourc e.

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 objectDatasourc e 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 ObjectDataSourc e 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
9604
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 programmatically manipulate them before they're bound to any data control. I'd be using them almost like you'd use recordset fields from Classic ADO. In other...
1
3852
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 using a GridView that has ViewState enabled, an ObjectDataSource to process the submitted list, textboxes for getting new item data and an add button. ...
2
3809
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 DataKeyNames parameter of "UserCompany, BillableCompany". The DetailsView has control parameters for its select method pointing to these two keys on the...
0
2168
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 or clear the boxes next to the potential members they want to add or remove.) The Object Data Source is as follows... <asp:ObjectDataSource...
0
5507
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 code what I think is a fairly typical Master/Detail scenario with two GridViews, using AJAX. Using the Northwind sample, I have two...
4
7067
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 App1ID = 1234; ObjectDataSource Appendix1 = new ObjectDataSource(); Appendix1.TypeName = "Appendix1BLL"; Appendix1.SelectMethod =...
0
2123
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 ControlParameter that has a ControlID that points to "lb_dates". The PropertyName of the ControlParameter is "SelectedValue". The user selects two dates...
0
4251
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 want to have my parameter names in those methods have to be "original_Parametername" or even if I change the OldValuesParameterFormatString to get...
0
1591
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 question (I guess that separate file would be called a bll). I had originally used the parameter list method to pass the inserted values to thie...
0
7438
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7707
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7951
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7466
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7803
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6036
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3475
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
751
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.