473,513 Members | 2,563 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CodeBehind for ObjectDataSource.TypeName

Visual Studio 2005/ ASP.Net 2.0
DAL in C# exclusively using XSD (strongly typed datasets)
WEB in C# references the DAL as needed via ObjectDataSources

My app has about 5 or 6 "reference" tables that I am creating a
"maintenance" web page for. The page has a dropdown control that lists
all of the reference table names. You pick the "Status Ref" item and
the GridView is refreshed to show the status data. Pick the "Stage
ref" item and the GridView is refreshed it show the stage data...you
get the idea.

The SelectedIndexChanged event on the dropdown table does something
similar to the following:

string ta = ddl.SelectedValue;
string typName = "DAL.dalTableAdapters." + ta + "TableAdapter";
ods.TypeName = typName;
gv.DataSourceID = ods.ID;

The ods is an object in the HTML markup where GetData, Update, etc are
all set...just TypeName is empty.

When the GridView refreshes to show the data, all looks well. However,
clicking Edit on the GridView produces the following error:

A type must be specified in the TypeName property of ObjectDataSource
'ods'.

I can overcome this by assigning the TypeName in Page_Load...but then I
lose all of the updated values. Looking at the sql trace stuff it's
the old values that are being posted back which tells me that if I set
TypeName in Page_Load I am overwriting the values.

So, you can see the dynamic need to have the TypeName blank in the html
markup and have it set dynamically on SelectedIndexChanged. The only
other solution is to create a separate page for each reference table
with all of the proper tableadapater stuff hard coded in the html
markup...I'd prefer not to do that.

Any ideas?

Jun 2 '06 #1
0 1798

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

Similar topics

2
2100
by: motorhead_maniac | last post by:
hi All, Iam having a objectdatasource control declared in the markup as <asp:ObjectDataSource ID="odsProperties" runat="server" TypeName="System.Collections.IEnumerable"...
0
1156
by: Ashish | last post by:
Hi All, I want to be able to specify typename property of the object datasource to the classname of the code behind of the user control that its declared on.. for example...
0
6980
by: Bryce Fischer | last post by:
I've got a simple (I think) asp.net application. I've created a DataSet in App_Code/ItemDataSet.xsd. Tested connection, seemed to work fine. In my ASPX file, I first dropped an...
5
2625
by: Randy Smith | last post by:
Hi ALL, I wonder if anyone has been using n-tier to bind to a GridView control by using the ObjectDataSource. This is our first OOP web application, and we have no tables. Right now we are...
1
3520
by: Allan Ebdrup | last post by:
I have a asp.net v2 website that runs fine on our development server. I have published the website to a stage server and it runs fine, but when I publish it to production I get the following error:...
0
5499
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...
0
1486
by: jobs | last post by:
re: ObjectDataSource SelectMethod TypeName returning a Dataset? is this really a DAL? Pardon my misguided email on the subject... I'm working in asp.net 2.0 and vb.net 2005. Say I don't...
1
2112
by: yanni | last post by:
Hello, I'm creating asp.net 2.0 web site app, I tried to use ¡°ObjectIssue.Page1¡± as TypeName of ObjectDataSource, received error message ¡°The type specified in the TypeName property of...
3
11153
by: btreddy | last post by:
Hii all, I've a problem regarding passing select parameters to objectdatasource from code behind. i would like to pass the select parameters to a objectdatasource ..not in the selecting or...
0
7259
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
7158
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
5683
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,...
1
5085
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
455
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...

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.