Question about DynamicField with ReadOnly property RRS feed

  • Question

  • User1644393125 posted

    I have a column that is "CreateTime".  I want this field not able to "Insert" or "Edit" but can "ReadOnly".  I just can assign InsertVisible="false" to let this field invisible in Insert mode but how can I let this field to be invisible or shown ReadOnly in Edit mode?

    Sunday, March 30, 2008 8:06 AM

All replies

  • User62194485 posted

    If you're using a bound column, I thought there's a IsReadOnly property.   If you're using a templatecolumn and textbox, again, set readonly or just change it to a label control as well (better). 

    Sunday, March 30, 2008 10:26 AM
  • User615869930 posted

    You should be able to open your Linq To Sql model in the designer, find the property, and set it's ReadOnly property to "True".  Internally, Linq will remove the setter for that property, and DynamicData will render it as read-only.

    Monday, March 31, 2008 2:01 PM
  • User1644393125 posted

    I tried to set this column's ReadOnly property to "True" in my LINQ to SQLClass Designer, but it still appear TextBox in Edit mode in the DynamicDetailsView.

    I'm using "ASP.NET 3.5 Extensions Preview (December 2007)".  Are you using the same version as mine?


    Monday, March 31, 2008 11:33 PM
  • User-797310475 posted

    I think this functionality should work in the December CTP as Leonid described. However, that version is quite outdated and you should check out the latest release on connect.microsoft.com 

    Tuesday, April 1, 2008 1:14 AM
  • User615869930 posted

    Please see this post for info how to get the latest version from connect.microsoft.com:  http://forums.asp.net/t/1236961.aspx

    Tuesday, April 1, 2008 2:15 PM
  • User949140326 posted

    I am also having same issue currently. I am using .NET 3.5 with VS 2008 for Dynamic Data.


    I have a gridview with boundfields and Dynamicfields for foreign key columns. When I open the page it looks good. In editing mode, the foriegn key columns are shown in dropdowns which can be edited. Is there any way that I can make them readOnly?

     I tried setting the readonly property to true in LINQ designer dbml file. But still i am able to edit that column. Please see my markup...

    <asp:DetailsView ID="DetailsView1" runat="server"DataSourceID="DetailsDataSource" DefaultMode="Insert"AutoGenerateInsertButton="True" OnItemCommand="DetailsView1_ItemCommand" OnItemInserted="DetailsView1_ItemInserted"

    AutoGenerateRows="False" ondatabound="DetailsView1_DataBound">

    FieldHeaderStyle CssClass="bold" />


    <asp:BoundField DataField="BookTransferID" HeaderText="transferid" Visible="false"/>

    <asp:DynamicField DataField="ProcessingCenter" HeaderText="From Submission Processing Center" />

    <asp:DynamicField DataField="ProcessingCenter1" HeaderText="To Submission Processing Center" />

    Friday, June 17, 2011 9:58 AM
  • User-330204900 posted

    Hi padkavi, you need to create a buddy/metadata class see 8. Using ASP.NET Dynamic Data from Pluralsight there are also some hidden DD video on asp.Net to.

    Friday, June 17, 2011 4:30 PM