.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

How disable constraints in MVC??

Posted By:      Posted Date: October 26, 2010    Points: 0   Category :ASP.Net

I have this 2 pasrial class:

public partial class Dinner :EntityObject {
        // with properties

and second for validators

    public partial class Dinner {

    public class Dinner_Validation {
        [Required(ErrorMessage = "Title is required")]
        [StringLength(50, ErrorMessage = "Title may not be longer than 50 characters")]
        public string Title { get; set; }
        [Required(ErrorMessage = "Description is require")]
        [StringLength(265, ErrorMessage = "Description must be 256 characters or less")]
        public string Description { get; set; }
        [Required(ErrorMessage = "Address is required")]
        public string Address { get; set; }
        [Required(ErrorMessage = "Country is required")]
        public string Country { get; set; }
        [Required(ErrorMessage = "Phone# is required")]
        public string ContactPhone { get; set; }
        [Required(ErrorMessage = "EventDate is required")]
        public DateTime EventDate { get; set; }
        [Required(ErrorMessage = "HostedBy is required")]
        public string HostedBy { get; set; }
        [Required(ErrorMessage = "Lat

View Complete Post

More Related Resource Links

Stored Proc to disable all constraints


I have been using the following stored proc to disable all constraints on my database tables so I can truncate them.

/****** Object: StoredProcedure [dbo].[sp_ConstraintState] Script Date: 11/26/2010 09:31:21 ******/









Use Membership but bypass / disable password usage for users


I have an application that does LDAP authentication. The authentication is done on the code behind page of my Login.aspx page. Once the user passes LDAP authentication, a cookie is set and I redirect:

FormsAuthentication.RedirectFromLoginPage(UserName.Text, False)

I would like to setup membership in my application and keep track of some user information. But due to company security requirements, I cannot store user passwords on my application. That must stay on the LDAP server only.

Is there a way to store users but disable password storage on the aspnet_membership table?

ReportViewer :: Failed to enable constraints. But my statement is valid!!

  • A
  • n error has occurred during report processing.
      • Exception has been thrown by the target of an invocation.
        • Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

    Why do I keep getting this error, even when not using any data on the report. When I run the query in SQL server I get a resultset. However when I try to render the report I get this error.


    Data Points: Disabling Constraints and Triggers


    What to do when you need to disable triggers and constraints to perform data synchronization and other tasks with an offline database.

    John Papa

    MSDN Magazine April 2007

    Disable check box in a gridview does not working



    I have a check box in a template field in a gridview.

    Based on some condition, I want those check boxs to  be enable and disable.

    I am trying the below code but does working..

     protected void GVstudents_RowDataBound(object sender, GridViewRowEventArgs e)
                  if (e.Row.RowType == DataControlRowType.DataRow)
                        string studentID = GVstudents.DataKeys[0].Value.ToString();
                        int stdID = Convert.ToInt32(studentID);
                        int schID = profile.getSchoolIDByStudentID(stdID);
                        int tchrID = profile.getTeacherIDByStudentID(stdID);
                        if (patti.chkIsTeacherPaid(stdID, schID, tchrID))
                            CheckBox cb = (CheckBox)e.Row.FindControl("chkTeacherPayment");
                            cb.Enabled = false;
                            cb.Checked = true;

    any help??

    Disable filtering on a Dynamic Data list view.


    I have an entity set of NotificationTemplates, and each one of these has a collection of zero-many SmsTemplate entities. When editing or viewing a NotificationTemplate, I have a link to View SMS Templates. That link takes me to a List view for the SmsTemplates entity set, filtered for the NotificationTemplate I was viewing.

    How can I prevent the user changing this filter to show SmsTemplates for another NotificationTemplate? That is, I want the filter, but it must be read only. The drop-down just mustn't drop down, it must just display the name of the NotificationTemplate that these SmsTemplates belong to. To view SmsTemplates for another NotificationTemplate, the user must click View SMS Templates from that other template.

    This was originally asked by myself on SatckOverflow at: http://stackoverflow.com/questions/3514373/disable-filtering-on-a-dynamic-data-list-view

    HTML Table Disable


    I have a HTML Table that I use to place the control in so they display nicely on my Web Form.  I also use the Disable method to keep unwanted users from editing those controls based on their log in information, however I still want the information to be displayed for their review.

    The information is displayed for example in the Text Boxes, however when they hit Enter on the form because the table is disabled for some reason the information is lost when I do my update to the SQL Server (the text box shows "")?

    Why is it I can see the information on the screen, but the text box shows empty when hitting enter on the form?



    Checkbox disable/enable


    I hope someone can be kind enough to help/advise me with this.

    I have a web form with multiple checkboxes on it , with one of the checkboxes as the main (controlling) checkbox.  By this I mean that when this main checkbox is checked then all the other checkboxes need to be disable and when its unchecked these other checkboxes need to be enable.

    I've found (plenty of) code to do this in javascript but i would really prefer to to it in vb(.net), if possible.

    I hope all this makes sense to you.


    Mission Impossible? Use Javascript to Disable a Multi-Line Rich Text Field


    Hey Community,

    Here's a tough one that I have struggled with and so far have not been able to find an answer for - how do you use Javascript to disable a multi-line rich text field.  I have customized a SP Edit form by adding a CEWP.  In the CEWP I have added the Javascript below (only a partial code sample provided) to disable several fields in the form.  The code works fine for single line text fields but it does not work for multi-line rich text fields.  Any suggestions?

    <script language="javascript">
    //This runs the function when the form first loads

    //This locks the fields the users should not modify
    function lockFields()
      var theInputTFTitle = getTagFromIdentifierAndTitle("Input","TextField","Title");
      theInputTFTitle.readOnly = true;
      theInputTFTitle.style.color = 'gray';
      //alert(" Value: " + theInputTFTitle.value);//for testing

       var theInputDDLReplyStatus = getTagFromIdentifierAndTitle("select","DropDownChoice","Reply Status");
      theInputDDLReplyStatus.disabled = true;
      //alert(" Value: " + theInputDDLReplyStatus.value);//for testing

      var theInpu

    Disable VS2005 Undo?


    Does anyone know if there is a way to disable the Undo feature within VS2005?  I searched through the options but nothing jumped out at me.


    Disable links based on membership



    I've somehow managed to successfully get Membership working on a test site I'm playing with (learning!). I've reached a point where I can redirect users to another page if they do not have the required level of membership - using the allow feature in a web.config within a folder.

    What I would like to do now is create a main menu of links (a back office menu visible after the use has logged in), and disable a link if they do not have access to view that page. Is this complex? I'd be grateful for any sample code to get me started.

    Many thanks

    disassembly tab window how to disable


    everytime i debug the application i get the disassembly tab window
     i tried tools/option & unchecked show disaasembly if not is not avaliable & sourec file to exce;ty open the original file

    but still i get
    after making the chnages i restarted my system but still i get it
    how do i disable teh disassembly tab

    sitemap control user rights enable and disable



    iam using masterpage and sitemap in my project, what i want to is that

    if user login is did, based on the user previlage in need to show the sitemap menu page

    if user i have the previlage to see the page then i should enable that page otherwise

    i need disable that page

    looking for the valuable suggestions

    System.Data.SqlClient.SqlException: Login failed for user . Reason: The account is disable


    Hi All,

    Thank you for advance.

    I created a widows service for mail schedule with c#.net and sql server 2005 and it is working fine for past one year.

    now sometimes i am getting the "System.Data.SqlClient.SqlException: Login failed for user '<UserName>'. Reason: The account is disabled." error.

    then i restarted the windows service manually and working.

    what is the problem in my sql server connection and how to fix that issue?

    How I disable vertical scroll bar of report viewer control on Web Form.


    I'm displaying .rdlc report file using Report viewer control on Webform. If  I Fix height of viewer control and data is not same as to size of viewer control then it display one scrollbar on viewer control and second vertical scroll bar is coming on webpage.

     I want to off viewer vertical scrollbar or in simple word's I don't want to display two scroll bar with my report. Please guide me or send me reference if any.


    How to disable textbox causing validation?

    Hello I was running into a strange problem: If I left a textbox blank (in some instances) the textbox would not give up the focus (I could not even close the form).  I learnt later that this was because the text in the textbox was causing validation to fail.  I would have to type in some value (Satisfy validation) before i could close the form. This is problematic for me and I don't want the textbox to behave this way (I do not awnt front end validation).  I desire to have validation done ONLY on the back end.     I thought that I could solve this problem by changing the 'CausesValidation' property in the textbox to false.  This worked!  However it introduced a new problem.  The binding no longer worked on the Textbox.  That is, whatever value I typed in the textbox would not make it to the data set. What is the correct way in solving this problem???  I want validation to be shut off however I still (obviously) need to keep binding in tact...      

    TabControl - Disable/Enable tab page

    I have a tabcontrol with 2 pages. OnLoad the 2nd Tabpage shall be disabled (grayed out and not selectable). Later with code I need to enable the 2nd tab. Any Ideas how this can be done? please./Morten
    ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
    Sql Server  SharePoint  Silverlight  Others  All   

    Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend