Forms Data Controls :: FormView - Set ObjectDataSource And Readonly Properties

Mar 25, 2011

I have a FormView bound to an ObjectDataSource that is bound to a business logic object. The business logic object has a Readonly field called "Id". When I try to update the formview, I get the following error message: The 'Id' property on the type specified by the DataObjectTypeName property in ObjectDataSource 'ObjectDataSourceNewsArticle' is readonly and its value cannot be set. How do I get the ObjectDataSource or the FormView to recognise that the id field is readonly, and to not try to update it?

View 3 Replies


Similar Messages:

Forms Data Controls :: Formview From Readonly To Edit Mode

Jan 14, 2011

there are 2 pages (SummaryGridviewPage.aspx and FormviewPage.aspx) there are insert, item and update templates in the FormviewPage 1st case - there is no problem to insert new record, select and update action in the FormviewPage

2nd case - However, there is problem when i select a record in GV and direct to FormviewPage for edit this code is added in Formviewpage to open the record at readonly mode, no problem

Private Sub RF_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
If Session("RecordID") <> "" Then ' to check New or Old record
SqlDataSourceRF.SelectParameters.Item("New_ID").DefaultValue = Session("RecordID")
FormViewProject.ChangeMode(FormViewMode.ReadOnly)
End If
End Sub

however, no record if go further from readonly to edit mode then Code is added to the Edit button

Protected Sub BtnEdit_Click(ByVal sender As Object, ByVal e As EventArgs)
FormViewProject.ChangeMode(FormViewMode.Edit)
SqlDataSourceRF.SelectParameters.Item("New_ID").DefaultValue = Session("RecordID")
FormViewProject.DataBind()
End Sub

Now edit problem is solved but when go back to the 1st case (new record, and then edit) Now new record can be inserted, and then show it in readonly mode. but then try to go to edit mode, no record show i think BtnEdit_Click code is conflicted with the built-in "Edit" command Could anyone show me some info how formview retrieve specific record in a proper way?

View 1 Replies

Forms Data Controls :: Formview Default Insert - Need ReadOnly View

Mar 22, 2010

I'm using a formview in Insert mode with an AccessDataSource. I want to switch to readonly mode upon insertion to let the user confirm the input worked, then give them the option to insert a new record. If I set the DefaultMode to Insert, then after the first record is inserted, I get a new blank insertion form (no confirmation). If I set the DefaultMode to ReadOnly, after insertion, I get a blank form (presumably because I am not on the record just inserted).

How do I get the just inserted record to display? If I need to set the ID of the formview to the just inserted record OnInserted, how do I get that given I'm using an AccessDataSource?

View 6 Replies

Forms Data Controls :: How To Set The Selectedvalue Of A Dropdownlist With Another Objectdatasource Used For Formview

Aug 10, 2010

I'm using a FormView which has odsMain as the datasource. I am also using a dropdownlist which is being populated with objectdatasource odsddl.

I'd like to set the selectedvalue of the dropdownlist with the value contained in odsMain (the current record value for it). Is there any way this can be done?

View 6 Replies

Forms Data Controls :: GridView Inside FormView With ObjectDataSource

Mar 20, 2010

I have an ObjectDataSource giving me data similar to: OrderNumber OrderDate OrderValue OrderItems The first three are simple data types and the last has multiple occurrences of another class: OrderLineNumber OrderItem OrderQuantity The ObjectDataSource will only contain one row (which might make things simpler). So, there will be one OrderNumber, OrderDate and OrderValue; and then several occurrences of OrderItems (each containing OrderLineNumber, OrderItem and OrderQuantity).

I am displaying OrderNumber, OrderDate and OrderValue in the FormView - that work's fine, as expected. I have placed a GridView within the FormView and am failing miserably to get it to bind to OrderItems. I have tried the obvious things like specifying "odsWhatever.OrderItems" as the DataSourceID for the GridView, but to no avail.

View 4 Replies

Forms Data Controls :: FormView Refresh Schema With ObjectDataSource Not Working

Jan 22, 2011

I'm having a problem with a FormView control that I have bound to an ObjectDataSource. The problem is that the FormView control is not automatically filled in with the public properties of the object linked by an ObjectDataSource control when I select refresh schema. Everything compiles and I can add fields manually, but there are a lot of properties in the class and I do not want to deal with adding all the fields by hand. It's not the end of the world of course if I have to add them manually, but I'm bothered more by the fact that it doesn't act the other formviews.

Has anyone ever experienced a problem like this? I have other objectdatasource controls with other formviews that properly refresh their schemas. I noticed that in the objectdatasource control that is giving me problems, the DataObjectTypeName field is not automatically set as it is in the others. However, after adding it manually it still doesn't refresh the schema. I'm using Visual Studio 2010. Defined in .aspx page:

[Code]....

The SPFModuleBLL class contains the GetModule2() method which is shown here:

[Code]....

View 3 Replies

Forms Data Controls :: ObjectDataSource Cannot Access GridView Control Inside FormView

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

Forms Data Controls :: Formview Paging Not Working With Objectdatasource And Viewstate Setup?

Oct 7, 2010

I was able to get the formview bound to the objectdatasource, it works great for the first record, but when i select the next record it gives me error below is all my code, if there is something else that i need to post .

[Code]....

View 3 Replies

DataSource Controls :: Setting Common Properties For An ObjectDataSource?

Nov 7, 2010

In my ASP.NET application I am using a lot of ObjectDataSource controls. I want to set the following three properties globally for all ObjectDataSource controls:

EnableCaching="true"

View 5 Replies

C# - UpdateMethod In ObjectDataSource Only Receive Values For Properties From Visible Controls In DetailsView?

Mar 26, 2010

I've written a class that contains Select- and Update-Methods for an ObjectDataSource. The UpdateMethod receives an instance of a called class. My problem is, that only properties that are Bound in the DetailsView are set, the others have their default value.Here's my code:Class declaration:

public class Foo
{
public string Prop1 {get;set:}
public int Prop2 {get;set;}

[code]...

View 1 Replies

How To Get The Inserted Id Or Object After An Insert With The FormView/ObjectDataSource Controls

Feb 22, 2010

I have a series of classes that loosely fit the following pattern:

public class CustomerInfo {
public int Id {get; set;}
public string Name {get; set;}
public class CustomerTable {
public bool Insert(CustomerInfo info) { /*...*/ }
[code]...

View 1 Replies

DataSource Controls :: Linq / ObjectDataSource With Only A Few Database Fields On Formview

Feb 24, 2010

I am working on an application and am attempting to use Linq with and ObjectDataSource but I only want to display/update 50% of the fields that are in the corresponding table. It appears to me that for this to work correctly, I need hidden fields on my form for all of the data fields from the table that the user cannot access. Is this the only way to do this? I have the following in my update method of my ODS:

[Code]....

The problem is, only the fields that appear on the form have data in them.

View 1 Replies

How To Change Properties Of Class In ObjectDataSource Updating-Event

Aug 9, 2010

I have the following situation:My business class:

public class Foo
{
public String A {get;set;}
public DateTime B {get;set;}
// .. and other properties like
public String Intern {get;set;}
}

I'm binding that Item to a DetailsView in Editmode. (I bind a List containing a single object of Foo, becuase I do recall that I can only bind IEnumerable<> classes to the DetailView)The binding is done via a ObjectDataSource

View 1 Replies

Forms Data Controls :: Accessing Master Formview Data From A Nested Detail Formview?

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

Forms Data Controls :: Set Value To Textbox In Nested Formview From Parent Formview Label?

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

Forms Data Controls :: Set ReadOnly For A GridView Column In C#?

Apr 11, 2010

I need to change ReadOnly from false to true for one column in GridView depending on who the user is. In my particular case it is a BoundField (also I would like to know how to do it for a Template field as well) and DataField is "dteRequired". I would like to code something like that right in the Page_Load handler:

View 8 Replies

Forms Data Controls :: Gridview Readonly Colums?

May 4, 2010

I have a problem specific to the gridview control, i am using the datasource to generate an update method for the data in my table.

Some of my columns are display only fields so i have set them to "read only = true" Everything seems fine when the page loads but when i click update, the columns that were editable update fine but the ones set to read only have now updated the databasewith a null value. Am i missing something here?

View 5 Replies

Forms Data Controls :: How To Check File (pdf) Is Readonly Or Not

Sep 3, 2010

Is it possible to to check while uploading pdf file that it is read only?

if it is possible than how to do that using c#??

View 5 Replies

Security :: PrincipalPermissionAttribute With An ObjectDataSource And A FormView

Mar 27, 2010

I have an ObjectDataSource which refers to a class in my business logic. I have added this code

[Code]....

to a method within the class. That is the method specified as the UpdateMethod of the ObjectDataSource. The ObjectDataSource is attached to a FormView. I am seeing the following behaviour: Before I add the attribute, the update function works as expected; With the attribute, if the user has TestRole then the update works as expected; With the attribute, if the user doesn't have TestRole then the update method does not execute, but no exception is thrown. So, the functionality is restricting access to the method exactly as it should. However, no exception is thrown when access is denied.

As an aside, I have tried adding the attribute to the class rather than to the specific method. With that in place, I do see an exception (if the user does not have TestRole) as soon as execution goes anywhere near the class. This cannot be my final solution though as different methods in the class need different restrictions. Obviously, I don't want the update to fail silently, I need the exception to be thrown so that I can handle it.

View 5 Replies

Forms Data Controls :: Formview That Use The Formview Iteminserted Event?

Jan 24, 2010

I have a formview that use the formview iteminserted event. The information inserts into the formview fine, but all cells blank out after the insert. How can I make it so I can show all the values I have inserted show up in the formview after the inteminserted event?

View 2 Replies

ObjectDataSource Databinding: Getting Object Properties By Select Method Call - How To Access Value

Feb 22, 2010

I am using an ObjectDataSource control to call a MapInfo object. This object has two properties:

public IList Visits
public int TotalAvailable

The select method returns an IList but the TotalAvailable property is also populated. I have set the TypeName in the ObjectDataSource to the MapInfo object but because the Select method only returns the IList I don't have access to the TotalAvailable.

[code]....

Is there any way to access this value. I know it is being populated in the MapInfo object but all that gets returned from the Select method is the IList

View 2 Replies

Custom Server Controls :: How To Get The Value Of Readonly Properties Of Server Controls Inside A Custom Server Control

Apr 4, 2010

I have a custom server control inheriting from CompositeControl. It consists of two RadioButtonlist controls that are rendered side by side in an html table. The number of ListItems in each RadioButtonList is not known until runtime. Depending on how many items each list contains, the RepeatColumns property of each list is set differently. To do this in the handler for the ItemDataBound event I need to get the count of ListItems in each RadioButtonList. How do I expose the Items.Count property of each internal RadioButtonList as a top-level property? I tried using a getter to return the count but this generates a compile-time error to the effect that the count cannot be assigned to--even though I have not created a setter.

Similarly, in the handler for the Submit event, I need to get the ClientID of each internal RadioButtonList to pass to a method that checks for data changes. How do I expose the ClientID of each component RadioButtonList as a top-level property?

I can of course index the Controls collection of the composite control to access the child control and read its properties--but that defeats the whole point of making a complex, independent custom server control.

View 1 Replies

Use ObjectDataSource With Complex Objects And FormView Control?

Dec 30, 2010

I have a complex object. For example a SCHOOL object that contains a collection of PERSON object. How can I use the ObjectDataSource control with a FormView and flatten the complex object? An example display would be to display the school name and comma separate the students on the page. Is this possible?

public string Id
{
get { return m_id; }

[code]...

View 1 Replies

Forms Data Controls :: Getting Values From Readonly Textbox In Gridview Footer Row

Sep 7, 2010

[Code]....

works if the textbox is not readonly. What do i do to get the readonly textbox value?

View 9 Replies

Forms Data Controls :: Set Readonly Attribute In Gridview Row Itemtemplate Textbox?

Mar 29, 2011

I have four Itemtemplate textbox with in my Gridview.... i want to set Readonly attribute dynamically only one itemtemplate textbox, how to do that,

I have done one for my gridview footer its working,

DirectCast(GridView1.FooterRow.Cells(2).FindControl("TxtSum"), TextBox).Attributes.Add("readonly", "readonly")

this time i'm expecting for row template textbox.

View 4 Replies







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