Showing posts with label ASP.Net Form. Show all posts
Showing posts with label ASP.Net Form. Show all posts

Wednesday, February 17, 2016

ModelState.Clear(); clear the form

 ModelState.Clear();

Wednesday, January 27, 2016

Monday, January 25, 2016

pressing Enter on Dropdownlist causing postback

User select the dropdownlist and key in something then press enter caused the screen become blank.

everything the press enter the screen will be blank.

http://stackoverflow.com/questions/19494198/pressing-enter-on-dropdownlist-causing-postback

add code below will solve the issue
UseSubmitBehavior="False"

ex.
<td align="right"><asp:Button ID="btnSave" runat="server" UseSubmitBehavior="False" Text="Save" /></td>

Friday, October 2, 2015

Assign value to session

 
                                Session(Util.ATTR_FORM_XML) = xml
                                Session(Util.ATTR_FORMNAME) = New Forms.xxx.xxx(xml)
                                Session(Util.ATTR_FORM_XKEY) = xKey
                                Response.Redirect("./formx.aspx?app=forms")

Saturday, April 25, 2015

Flight editor template

@model RegMSW.Web.Models.flightInfo
  
    <div class="form-inline">
            @Html.ValidationSummary(true, "", new { @class = "text-danger" })
            <div class="form-group">
                @Html.LabelFor(model => model.pickup, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-1">
                    <div class="checkbox">
                        @Html.EditorFor(model => model.pickup)
                        @Html.ValidationMessageFor(model => model.pickup, "", new { @class = "text-danger" })
                    </div>
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.airport, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-1">
                    @Html.EditorFor(model => model.airport, new { htmlAttributes = new { size = 3, @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.airport, "", new { @class = "text-danger" })
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.airline, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-1">
                    @Html.EditorFor(model => model.airline, new { htmlAttributes = new { size = 8, @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.airline, "", new { @class = "text-danger" })
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.fligtNo, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-1">
                    @Html.EditorFor(model => model.fligtNo, new { htmlAttributes = new { size = 6, @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.fligtNo, "", new { @class = "text-danger" })
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.fligtDateTime, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-1">
                    @Html.EditorFor(model => model.fligtDateTime, new { htmlAttributes = new { size = 17, @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.fligtDateTime, "", new { @class = "text-danger" })
                </div>
            </div>
        </div>

Friday, April 17, 2015

javascript in master page

Add JavaScript between head then F12 to check if it is loaded. and the JavaScript is available for all content pages.


<head runat="server">
    <title>my page</title>
    <link href="~/styles.css" type="text/css" rel="stylesheet" />
    <link href="~/Scripts/jquery-ui-1.8.13.custom.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src='<%= ResolveUrl("~/Scripts/jquery-1.6.1.js") %>'></script>
    <script type="text/javascript" src='<%= ResolveUrl("~/Scripts/jquery-ui-1.8.13.custom.min.js") %>'></script>
    <script type="text/javascript" src='<%= ResolveUrl("~/Scripts/jquery.watermark-1.2.2.js") %>'></script>
     <script type="text/javascript">    
        function masterPageShowError(error) {
            var stackTrace = error.get_stackTrace();
            var message = error.get_message();
            var statusCode = error.get_statusCode();
            var exceptionType = error.get_exceptionType();
            var timedout = error.get_timedOut();
            alert(message);  
          }
     </script>
</head>

Wednesday, April 8, 2015

Using MVC, how can I show or hide elements based on a checkbox?

http://stackoverflow.com/questions/14713366/using-mvc-how-can-i-show-or-hide-elements-based-on-a-checkbox

Saturday, April 4, 2015

readonly on form

http://stackoverflow.com/questions/1359389/make-all-form-fields-readonly-in-mvc

http://forums.asp.net/t/1799359.aspx?ReadOnly+for+MVC+Razor+Form

Friday, March 6, 2015