C# - Using ObjectDataSource And DataObjectTypeName - Handle Delete Methods With Just An Id Parameter?

May 27, 2009

If I have an ObjectDataSource setup like:

<asp:ObjectDataSource
ID="ObjectDataSource1"
runat="server" [code].....

How do I get the objectdatasource to use the Delete method with the parameter that is not an Employee object? what is the recommended alternative architecture?

Edit:

To clarify, I want to use the method signature on my data/business object as shown above, however if I try to allow an Employee object to be passed into some of the methods using DataObjectTypeName, then I seemingly lose the ability to have some methods take just an integer id for instance.If I do not use the DataObjectTypeName, then I have to place all the method parameters in the ObjectDataSource and change the methods on the data/business object to match, this seems like a bad design choice because as the Employee object changes I will have to update each of these methods.

View 6 Replies


ADVERTISEMENT

Can't Find Any Methods To Handle Encoding?

Jun 14, 2012

I am not really looking for any code here, I am trying to find out why I can't find any methods to handle encoding while saving text to an html using the savefiledialog. I have searched everywhere I know and can't find anything on it.

Very simply I have a textbox that holds a bunch of html...I have a function that allows you to preview the html as document text in the web browser element. No problem...works great...But when I save the html to an html file I clearly have an encoding issue:[URL]..I am really just looking for the information that will help me to correct this issue (put me in the right direction at the very least)

View 3 Replies

C# - Generate And Handle User Messages Inside Methods?

Aug 5, 2011

What is the best way to handle a function that might occasional fail to evaluate, but even when it does fail does not require a halt of the parent routine, though sometimes might require an explanation to the user?I have such a function, deep in my code, that returns a number. Codingwise, the simplest approach would be to make the function nullable, and return null when it can't evaluate. That way the calling routine can continue while also knowing the function failed to return a number.

However, depending upon the circumstances, sometimes I want to display the reason for the fail to the user so they know what to fix. Obviously just returning null isn't enough information. Should I be raising messages inside the function itself as it evaluates for anonymous listeners to catch, to be displayed if desired?(For those rightfully pointing out that logic functions shouldn't be responsible for creating user messages, I didn't mean to imply the function generates the full text message, just somehow transmits the reason for the problem so that the UI could later parse that into a message)

The other option I suppose would be throw exceptions inside the function if it can't evaluate, then catch and interpret to user messages if desired. However, as stated the inability to evaluate typically does not signify a halt to the routine, and now I'd have to put a Try...Catch block around the function call everytime I use it.

View 7 Replies

Handle Case Sensitive Classes And Methods From A C# Web Service In .net App?

Jun 22, 2011

I am working on a VB.Net application that needs to access a web service that I am nearly certain has a C# backend. At bare minimum, the backend is providing classes to me that are differentiated only by case, and within a number of those classes, there are properties and methods that are only differentiated by case.

VB.Net is case insensitive, and it sees a number of these items as being ambiguous.I've thought of a few ways of dealing with this, but I would like suggestions before I go down a road that is likely difficult.

Here are some ways I have considered going about it.Modifying the generated code for the wsdl. This has presented problems in responding as the xml output would no longer conform to the webservice requirements.I think there might be some attributes I could use to override this, but I'm not sure what they are yet. Even so, this web service gets frequent updates and I would hate to have to keep refixing the service every time I refreshed it.Creating a csharp wrapper project where I expose the underlying classes with different names. Primarily through inheritance. Although the big problem here has been the issue with properties and methods that are only differentiated by case as well.

I'm sure at some point I could get one or the other of these solutions working, but if anyone has any better suggestions that I'm not thinking of,

View 1 Replies

Parameter Descriptions For Custom Methods?

Jun 16, 2010

This is more of a user-proofing and aesthetics questions,Whenever we call a method in the .NET framework that requires parameters (most of them), as we're typing the parameters we wish to pass, Intellisense not only tells us the parameter type we need to enter, but it also gives us a brief description of what the parameter is.

Is there any way that we can include that same functionality in the methods that we write?

View 2 Replies

Remove The Add / Delete Methods From The Class

Feb 17, 2012

I created a Class that inherits List(Of TKey, TValue) and adds a few functions. Its purpose is not to add items to it at runtime, but when it is initialized. I would actually like to remove the add/delete methods from the class (as it currently exposes them from the inherited class).

[Code]...

View 2 Replies

Invalid Parameter: Name Handle Exception

Nov 23, 2009

I am using VB.Net code to print barcode label in Zebra TLP 2844 printer. And the printer is connected to system by USB port. When i execute the code i get an error "Invalid Parameter : Name handle" in the line outFile = New FileStream(_SafeFileHandle, FileAccess.Write) . As this is a USB port So i shared the printer and used the UNC path. But still i get the error. Below is the complete code

[Code]....

View 3 Replies

How To Handle Variable Type (parameter & Return Value)

May 25, 2011

Is it possible to replace these two functions

Function f1 (s As String) As class1()
Dim a() As String = Split(s)
Dim b(UBound(a)) As class1

[code].....

View 3 Replies

Handle DELETE Statement Conflicted With REFERENCE Constraint

Mar 1, 2011

im using try catch to handle this error uponm deletion of record that is foreign key to other table but it seems that my try catch is not working. im using asp.net (VB). can anyone help me???' i want to display an error message in my page.

View 1 Replies

IDE :: ObjectDataSource X64 Bug?

Jan 26, 2012

Original project is VB, but did other testing in Web Developer.Essentially, when a project is compiled as x64 in the ".inx64" directory, "Choose a Business Object" ends up being empty.My workaround was to go into the project's properties and change the compile directory from ".inx64" to just ".in".

View 4 Replies

C# - Use Multiple Objectdatasource In Detailsview?

Nov 14, 2011

Just want to ask, can we use multiple objectdatasource in detailsview?

Example, i have 2 different tables with same fields.

Insert, Update much work properly.

View 1 Replies

Mvc - Repository Pattern Implements Methods By Adding Add1 But Should Use Methods Of The Baseclass?

Aug 29, 2011

This is the original code in c#

public class CategoryRepository: RepositoryBase<Category>, ICategoryRepository
{
public CategoryRepository(IDatabaseFactory databaseFactory)
: base(databaseFactory)

[Code]...

Does anyone has an idea what i should change to let it work and let my UserRepository use the methods in RepositoryBase while implementing the IUserRepository?

View 1 Replies

.net - Modifying ObjectDataSource Deleting Parameters?

May 26, 2011

I am trying to add a parameter to the deleting event of an ObjectDataSource as in the example below from msdn. I generated an event handler for the ObjectDataSource's deleting event, and it had the same signature as in the example, however, when I try to clear the paramsFromPage as in the example, I receive an error stating that

View 1 Replies

Checking Return Of Objectdatasource.select()?

Jan 17, 2010

I just wonder if it is possible to simply check if the objectdatasource.select() returns any rows?e.g.

If ObjectDataSourceM.Select().GetEnumerator Is Nothing Then
'..
End If

View 7 Replies

Updating Custom Objects With ObjectDataSource?

Mar 7, 2011

I am using VS 2010 web application projects

I have an object datasource connetced to a custom object. The data from objectdatasource is displayed

in the Formview. When i try to do the Update. It sends me two empty objects of the class.

This is my objectdatasource

<asp:ObjectDataSource ID="obj1" runat="server" SelectMethod="GetValues"
TypeName="CustomDAL" ConflictDetection="CompareAllValues"
UpdateMethod="Edit" OldValuesParameterFormatString="old_{0}"

[Code].....

View 1 Replies

Asp.net - ObjectDataSource.Select() Not Always Firing On Page Postback

May 15, 2012

I have a form with:

[Code]...

Whenever I change the value of MyTextBox and press MySubmitButton, the select method of MyObjectDataSource is invoked and everything works OK. But if I change the value of any of my check boxes (without changing the value of MyTextBox) and press MySubmitButton, the select method is not invoked, thus the "MyObjectDataSource_Selecting" event doesn't take place and I get the same results as before.

One way I found to work around this was to explicitly invoke MyGridView.DataBind method whenever MySubmitButton was clicked. Is this the best way to handle these type of parameters? What I am afraid is that this may cause the select method to be called twice making the page slower.

View 1 Replies

Building A ASP.NET Profile Wrapper To Use With An ObjectDataSource Control?

Dec 26, 2011

building a ASP.NET profile wrapper to use with an ObjectDataSource control. I would like to have the serialized profile data that I have defined in web.config be accessible via a FormView control within a user control. I'd like the users to be able to view and update their profile data. I have part of the code but am lacking the experience to complete it. I'm using a aspx page with some text boxes and having users update via a simple form now but I need something more reusable and efficient, not to mention moving the logic to a middle tier. I see that the ObjectDataSource control has some intrinsic ability to view profile common data but that seems to be limited.

Namespace SiteMemberShip
Public Class ProfileWrapper
Private FirstName As String
Private MiddleName As String

[code]....

View 10 Replies

IDE :: Pass Parameters To Stored Procedure Through ObjectDataSource?

Jun 7, 2007

I am building a three tierd app, and therefore have all my data access methods in a class by itself.This class only calls stored procedures, basically, I need to pass in the following:

1) stored procedure name as string

2) parameters as IDataParameter() -- an array of parameters

3) other fields ( not important to this discussion)

If I use a GridView on my web form and choose an ObjectDataSourceObjectDataSource, and then choose my business object and method, since the method is a call to a stored procedure with a parameter array, I don't know how to pass it values in the IDataParameter format.The Method Signature listed on the wizard is "RunSP(String spname, IDataParameter[] params), returns SqlDataReader" which basically is calling a method called RunSP with two parameters, of which the second parameter is a parameter array for a stored proc.

View 3 Replies

Getting The Selected Row From A FormView Bound To ObjectDataSource In The ItemUpdating Event?

Oct 16, 2010

I have to maintain an ASP.net application in VB.Net.There is a page with a FormView bound to a ObjectDataSource.I have to add some business logic on the ItemUpdating event of this FormView.Unfortunately, some the data that I need to add this business logic is not exposed on the FormView user-interface itself, so I can not use FindControl to get the values (I could add the controls, bind them to the fields I need and set their visible property to true, but that's ugly).

View 2 Replies

Cant See Available Methods List When Write Object.METHODS?

Jun 24, 2011

I am working with a vb program, but there is something strange on one of my .vb code pagewhen i put the "dot" afther the object name its dont show the methods availables for this objectbut on other vb code pages i can see it. but in this one no.for exmaplethis is a piece of code: Dim sb As New StringBuilder()

View 3 Replies

Making Class Methods Instead Of Instance Methods In .NET?

Mar 29, 2010

I am not sure how clear my question is by the title, but I am trying to make Class methods instead of Instance methods in Visual Basic that way I don't have to waste memory and code creating temporary objects to execute methods that don't need instance variables.

I am not sure if you can do that in VB but I know you can in Objective-C by using either a "+" or "-" sign in front of the method declaration. And in C++ (at least I think, I can't remember) you put the static keyword or const keyword in front of the function.How would I do this in VB if it is possible? Or should I just make a separate set of functions that are not members of a class?

View 2 Replies

Asp.net - Pass A Value To From Listview Item Control To Another ObjectDataSource Inside In The Same Place?

May 8, 2011

i have to list views A,and B listview B is inside listview A. i want to pass some parameters from Listview A to Listview B's ObjectDataSource.

View 1 Replies

How To FileInfo Before, Delete Or SHIFT + DELETE, Process Final Delete Of File

Feb 13, 2011

How can be find out which file is going to delete when, user provides command like DELETE or SHIFT + DELETE or by programmatically gives DELETE command. Well I know about FileSystemWatcher Class, but this class doesn't provide information before delete...

View 1 Replies

2 Different Methods Using Same Object Methods?

Aug 26, 2010

Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim someproc As Process

[Code]...

View 3 Replies

.net - A Parameter Is Missing [ Parameter Ordinal = 1 ] Error In Pocket PC Application

Apr 21, 2011

Following code doesnt work and raise error "A parameter is missing. [ Parameter ordinal = 1 ]".What s wrong with it?I am developing pocket pc application in vs 2008 and sqlce 3.5 sp1.

[code]....

View 1 Replies

Call The Stored Procedure Which Has One Input Parameter And One Output Parameter?

Mar 21, 2009

I'm Trying to Call the Stored Procedure which has one input Parameter and one output parameter . VB.net code is below

[Code].....

View 2 Replies

VS 2008 Template Function That Can Receive Different Parameter And A Type Parameter

Mar 9, 2011

I want to have a "template" function that can receive different parameter and a type parameter, like:[code]But Vb told me that tupeList is not defined... is there a way I can do that?

View 2 Replies

A Procedure With A Single Parameter But The Input Values For That Parameter Are More Than One?

Oct 26, 2011

Is it possible to make a procedure have a single parameter but the values for that parameter are more than one? I have this procedure:

Public Sub autoComplete(ByVal cboCombo As ComboBox)
With cboCombo
.AutoCompleteMode = AutoCompleteMode.Append[code]....

Now I was wondering if there is a way to use it like this:

autoComplete(myCombobox1, myCombobox2, myCombobox3)

Or can I use a procedure like this with 'With...End With'?

View 1 Replies

AddressOf With Parameter - Method Which Requires A Parameter To Be Passed In

Mar 1, 2009

I have a method which requires a parameter to be passed in. I would like to use the Addhandler to call the method through a dynamically created button control's click event.

When I include () in the AddressOf, VS complains: 'AddressOf' operand must be the name of a method (without parentheses).

When I exclude the brackets, VS complains: Method '...' does not have a signature compatible with delegate...

My code:

CODE:

View 5 Replies

ToolTips, Parameter Options, And Parameter Groups For New Code?

Dec 10, 2008

One of the things that I think is really cool about VB.NET is how built-in functions and subs have extra help text in their ToolTips like "Expression: String expression to search for replace string." as well as the usual "Replace(...parameters...) as string" text. So are the pop up boxes with things like "CompareMethod.Binary" or "CompareMethod.Text." And finally I like how some functions and subs have different sets of parameters for the same routine. For example, New FileStream() starts with either a path (string) parameter or handle parameter, but none of the 15 sets of parameters contain both path and handle parameters. Is there a way that I can set up the classes and functions I write to use these things or do they only work with built in classes and functions? If there is a way, what are the proper names for them so I can look them up in the VS/VB documentation? I would be happy enough if someone would give me an example of them, but it would be nicer if I could go through the documentation and find out if there are other cool things that are related or near by.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved