Forms Data Controls :: Access A Method Of Entity Class From A FormView?
Feb 24, 2010
I have a Customer database table with a text field named customerPicture with the name of the JPG file.
I have made a Customer Entity class with the LinQ to SQL Designer.
I also have a FormView displaying Customer instance binding with a LinqDataSource.
My problem is:
I want to make some modifications when some control want to bind the customerPicture field.
For example, when my FromView want to show the field customerPicture I want to return not only the JPG file name, I want to modify this string to add the complete file path and perhaps resample the image to a determinate width and height.
I know that is posible to defeine a partial class named Customer to implement certains partial methods, like OnCustomerPictureChanged(), but I dont know how to do this.
If I make, in this Customer partial class, a new method, for example getResamplePicturePath(), how could I invoke it from a FormView?
View 10 Replies
Similar Messages:
Oct 18, 2010
I have an ObjectDataSource that I want to perform updates using a business entity i.e. Type="Object"). Since the values for the entity are within a user control, I have stored a reference to the control in Session and in the updating event, set the new instance to the value of the entity from the user contol property (which also pulls values from the form viaother properties of the control):
Protected Sub MasterDataSource_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs) Handles MasterDataSource.Updating
Dim entity As New Login()
Dim accountControl As AccountInfo = TryCast(Session("AccountCtrl"), AccountInfo)
entity = accountControl.Entity
e.InputParameters.Add("entity", entity)
End Sub
And here's the markup for the datasource:
<asp:ObjectDataSource ID="MasterDataSource" runat="server" EnableCaching="true" CacheDuration="10"
SelectMethod="SelectAll" UpdateMethod="Update" TypeName="Data.DAL.LoginDAL">
</asp:ObjectDataSource>
My question is, how can I get the update method to pass this entity to the update method in my BLL class? It seems the Update method requires an ID or reference to the original object to use in determining whether any changes have taken place, but I don't really want to do this. In other words, I just want to use the Update event on my ObjectDataSource to pass my entity to the method ("Update") I set as a property and then let this business method handle the update of the data. Shown below, is the BLL update method I want to call:
Public Overloads Function Update(ByVal entity As Login)
If entity Is Nothing Then
Throw New ArgumentNullException("entity")
End If
MyBase.Update("UpdateLogin", entity.Username, entity.Password, entity.FirstName, entity.LastName, entity.Role, entity.Region, _
entity.Email, entity.Title, entity.TierID, entity.Street, entity.City, entity.State, entity.Zip, entity.Mobile, entity.Phone, entity.Fax)
End Function
When I try to call this as it stands now, I get an error: ObjectDataSource 'MasterDataSource' could not find a non-generic method 'Update' that has parameters: ID, entity. Previously, I'd set up a long list of parameters of basic data types (string, int, boolean), but this is rather cumbersome and I was hoping to use an entity for this (FYI, I also got the same type of error when I tried this approach, but with the ID as the
last parameter in the list). Perhaps what I'm doing here is atypical to how the ODS is normally used?? Has anyone done something like this successfully?
View 1 Replies
Feb 1, 2010
I want to delete entity from linq class this entity has one to many relationshipe with another table so I want to delete all entities related to this one for example I want to delete classroom so i should delete all student is this classroom fisrt i don't how to delete all these student in one time
View 1 Replies
Nov 18, 2010
I've been pickling my brain trying to do this for a couple of days but to no avail. I have the following in "FormView1" which I'm just using in insert mode:
<td class="style4">
<asp:TextBox ID="urlTextBox" runat="server" Text='<%# Bind("url") %>' CausesValidation="True" Width="200px" />
</td>
I'd like the contents (i.e. whatever the user wants to insert) to be passed to a method where it will be checked against any existing values in the database.
View 4 Replies
Jan 19, 2010
I have method that I call which needs to find all the panels in the page but it fails. I have another method that was created by the VS has the traditional paraeters such the object sender, EventArgs e that the similar code works fine but the (simplyfied) code below. It is clear to me that these parameters contain information that makes one method work while the other not, but I don't know why.
The code breaks on the last line of code: _pnlAssetInfo = (Panel.....
[Code]....
View 3 Replies
May 4, 2010
Is there an equivalent of the GridView.RowDataBound event for the DetailView and FormView controls in ASP.NET 3.5?I need to manipulate data after Selecting it from my database, but before it gets presented to the user. I've read the documentation but I think I've missed something because I can only find FormView.DataBound which is called after the entire control has been data bound. Something like an ItemDataBound event would be what I need....?!?
View 6 Replies
Apr 25, 2010
I'm face of a little problem when using GridView, an EntityDatasource and entity custom properties using a partial class. I'll describe it and I hope that someone has already find the solution because I try to figured out since two days.
View 4 Replies
Jul 23, 2010
I've moved a class in my project into a class Library in the same solution. I've added a reference in the web project to the class library.
How do I access the methods in the class library?
View 2 Replies
Feb 25, 2010
Do i remove the ability to call a method from the class my page is inherited from?
I am trying to build my custom Role Provider and certain method i not want to be accessible.
View 2 Replies
Nov 17, 2010
I have some confusion with singleton class, below are my some points:
1.Can singleton class have static method?,if yes then how we call that methods?
2.what is main difference between Static class and Singleton Class?
I have created my singleton class as follows:
[Code]....
In Above class structure I have created two method one is Static and second is non static, When I am trying to access Static Method it gives me compile time error.
How can I use static method of singleton class?
View 7 Replies
Oct 27, 2010
How do I access a specific control within a FormView's "<InsertItemTemplate>"?
View 2 Replies
Jan 30, 2010
I am trying to access accessing a control in a Formview. I have tried several methods, but nothing seems to work
[Code]....
[Code]....
View 6 Replies
Sep 9, 2010
I have a main formview which contains another formview. In the second formview I have a section that needs to insert/update. I want to access this formviews events for example I can access the main formviews item inserted event in the code behind:
FVInvoiceHCPAgreement_ItemInserted
I can't choose the nested formview events in the code behind
ie. FVInvoicePaymentInfo_ItemInserted
I have tried adding the ItemInserted event in the .aspx page
i.e. onItemInserted = "FVInvoicePaymentInfo_ItemInserted"
but for the handles clause it can't see FVInvoicePaymentInfo.
View 3 Replies
Aug 3, 2010
I am trying get a file upload DLL control ( Subgurim.Controles) to function inside of a FormView
I have it registered as an assembly, but FileUploaderAJAX1 is not in context.
I tried :
[Code]....
View 1 Replies
Jul 7, 2010
Really new to C# & Web developing - but have used the DAL & BLL model from a number of the turorials. Have a situation that I not sure the best way to accomplish. I have an application dealing with courses, books, etc. utilizing an Access Database. All was going well in creating an on-line catalog using Formview and tables to display the db values stored in the Course Table (Course ID the key). User is able to use dropdown list to locate the course - dropdown list showed the Course Nbr & Name, but used the Course ID to get the detail. This issue appeared when they introduced a Prerequisite field in the Course Table. This contains the Course ID of the prerequisite course, but they want to display the Course Nbr and Name in the table field. So today it show 18 (Course ID) and they want B101 Intro to Biology. Hope I have provided enough information of what the code looks like below
Here is the FORMVIEW & TABLEROW
<asp:FormView ID="FVGeeralidades" runat="server" DataKeyNames="ClaveAsignaturas"
DataSourceID="ObjectDataSource1">
<ItemTemplate>
<asp:TableRow ID="TableRow5" runat="server">
<asp:TableCell ID="TableCell11" runat="server" HorizontalAlign="Left" Text="<STRONG>1.6</STRONG> Prerrequisito"
Width="150px"></asp:TableCell>
<asp:TableCell ID="TableCell12" runat="server"></asp:TableCell>
<asp:TableCell ID="PrerrequisitoValue" runat="server" HorizontalAlign="Left">
<%# Eval("AsignaturaPrerrequisito")%>
</asp:TableCell>
Here is also the OBJECT DATA SOURCE
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetCourseByCourseID" TypeName="CoursesBLL">
<SelectParameters>
<asp:ControlParameter ControlID="DDLCourse" Name="CourseID" PropertyName="SelectedValue"
Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
View 1 Replies
Mar 18, 2010
I have a formview and a few buttons outside the formview. How can i access the formview.itemcommand event if the buttons are not in the formview?
View 9 Replies
Mar 15, 2011
recommend a data access class / helper class for Access databases, similar to the sqlhelper class found in the (Data Access Application Block)?
View 6 Replies
Apr 16, 2010
Basically as the title of this thread states, I have a FormView that has a GridView inside it and my ObjectDataSource that populates this grid cannot access the Grid.
The Control Id needs to be the name of the Grid I want to access, however through the 'wizard' the Control parameter drop down cannot 'see' the grid I need, only the FormView that is in.
I have tried numerous ways to get round this and am struggling now..
I've tried the following...
ControlID="FormView.GridView1"
ControlID="FormView.FindControl("GridView1")
ControlID="<%= GetNameOfGrid %>"
and numerous other attempts that also failed that I now cant remember...
View 2 Replies
Jan 6, 2010
I have a regular method I want to call. I need to use properties of the GridViewRowEventArgs Class within this method.
i.e.
[Code]....
Of course the above code is not valid because I don't think you can put GridViewRowEventArgs within the method like that. I don't want to put it within a event handler because that even handler is doing other things. I want to be able to call this seperatley.
View 2 Replies
Aug 3, 2010
I have an access database where when the record is updated I would like to automatically check a box and update the date to the current date in an Access 2002-2003 database. I've tried this for several days without any resolution and can't find anything that works on the net. ...I'm new at this.
I'm using VWD 2005 Express and Expressions Web 3.
Here is a short version of the code.
[Code]....
View 5 Replies
Apr 3, 2010
I have the follow form view:
<asp:FormView
DefaultMode="Edit"
ID="FormView1"
runat="server"
onitemupdating="FormView1_ItemUpdating">
<EditItemTemplate>
<asp:TextBox
ID="txtPrimerNombreNatural"
runat="server"
SkinID="texto"
MaxLength="30"
Text='<%#Bind("PrimerNombre") %>'></asp:TextBox>
<asp:TextBox
ID="txtSegundoNombreNatural"
runat="server"
SkinID="texto"
MaxLength="30"
Text='<%#Bind("SegundoNombre") %>'></asp:TextBox>
</EditItemTemplate>
</asp:FormView>
<asp:Button
ID="Actualizar"
runat="server"
Text="Button"
CommandName="Update"
/>
This formview is bound in this way:
protected void Page_Load(object sender,
EventArgs e)
{
Persona _persona =
new
Persona();
_persona.ObternerPersonaByUserIdApp(1);
List<SILPA.AccesoDatos.Generico.PersonaIdentity> persona =
new
List<SILPA.AccesoDatos.Generico.PersonaIdentity>();
persona.Add(_persona.Identity);
FormView1.DataSource = persona;
FormView1.DataBind();
}
When the page is shown, the textbox are filled correctly, this textbox are filled with the "primernombre" and "segundonombre" properties from the persona class. After this, If I change the textbox, and after click the update button, I need to update the persona class with the changes from the textboxes, then I call a ActualizarPersona method for updating the database. How can I do for update the persona class when I change the textboxes and click the update button? I try this method protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs
e)
{
}
View 1 Replies
Aug 20, 2010
Since we can access the private data member of base class in the derived class with the help of friend function. How can we do the same in C# asp.net? I mean whats the alternative of friend function in C# asp.net
View 2 Replies
Sep 10, 2010
I would like to ask if it is possible to access data on a master FormView from a nested detail FormView.
I have a main form (master) with several tabs (detail) and would like to display a label with text from main form that is hidden by the tab at the moment of editting. My asp page looks like this.
[Code]....
Is it possible to get the value of the label CompanyTextLabel from CompanyTextBox using just ASP.NET expressions or something similar without writing c# code in .cs file?
View 4 Replies
Apr 10, 2010
I have a nested formview. I need to set a value for a textbox when I'm in insert mode from parent formview which is editmode.
View 4 Replies
Feb 23, 2010
I have extended a Entity class created by the designer (Linq to SQL). I have create a partial class called Promotion (App_Code/Promotion.cs) and I have added some new methods. But now, I want to access this methods from a FormView control and I dont know how to refer to the instance of the entity.
In the ForView, I can do:
[Code]....
And now Im accessing to one STATIC method of my completed Promotion class (App_Code/Promotion.cs)
But I dont know how to do to call a instance method
[Code]....
My firs though was to use the reserved word this, jejeje, but this refer to the web page instance..
View 5 Replies