我有一个母版页,代码在下面
<%@ Master Language="VB" CodeFile="Admin.master.vb" Inherits="Admin" %>
<!DOCTYPE html >
<html >
<head runat="server">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="" />
<meta name="author" content="" />
<link rel="shortcut icon" href="images/favicon_1.ico" />
<title>Bright Coaching Centre</title>
<!-- Base Css Files -->
<link href="css/bootstrap.min.css" rel="stylesheet" />
<!-- Font Icons -->
<link href="assets/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
<link href="assets/ionicon/css/ionicons.min.css" rel="stylesheet" />
<link href="css/material-design-iconic-font.min.css" rel="stylesheet" />
<!-- animate css -->
<link href="css/animate.css" rel="stylesheet" />
<!-- Waves-effect -->
<link href="css/waves-effect.css" rel="stylesheet" />
<!-- Custom Files -->
<link href="css/helper.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<!-- Plugins css-->
<link href="assets/tagsinput/jquery.tagsinput.css" rel="stylesheet" />
<link href="assets/toggles/toggles.css" rel="stylesheet" />
<link href="assets/timepicker/bootstrap-timepicker.min.css" rel="stylesheet" />
<link href="assets/timepicker/bootstrap-datepicker.min.css" rel="stylesheet" />
<link href="assets/colorpicker/colorpicker.css" rel="stylesheet" type="text/css" />
<link href="assets/jquery-multi-select/multi-select.css" rel="stylesheet" type="text/css" />
<link href="assets/select2/select2.css" rel="stylesheet" type="text/css" />
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<script src="js/modernizr.min.js"></script>
<asp:ContentPlaceHolder id="head" runat="server"></asp:ContentPlaceHolder>
</head>
<body class="fixed-left" >
<form id="form2" runat="server">
<div>
<!-- Top Bar Start -->
<div class="topbar">
<!-- LOGO -->
<div class="topbar-left">
<div class="text-center">
<a class="logo"><i class="md md-terrain"></i> <span>Bright Coaching</span></a>
</div>
</div>
<!-- Button mobile view to collapse sidebar menu -->
<div class="navbar navbar-default" role="navigation">
<div class="container">
<div class="">
<div class="pull-left">
<button class="button-menu-mobile open-left">
<i class="fa fa-bars"></i>
</button>
<span class="clearfix"></span>
</div>
<form class="navbar-form pull-left" role="search">
<div class="form-group">
<%--<input type="text" class="form-control search-bar" placeholder="Type here for search...">--%>
</div>
</form>
<ul class="nav navbar-nav navbar-right pull-right">
<asp:HiddenField ID="Usrid" runat="server" />
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
</div>
<!-- Top Bar End -->
</div>
<!-- ========== Left Sidebar Start ========== -->
<div class="left side-menu">
<div class="sidebar-inner slimscrollleft">
<div class="user-details">
<div class="pull-left">
<%--<img src="images/users/avatar-1.jpg" alt="" class="thumb-md img-circle">--%>
</div>
<div class="user-info">
<asp:Label ID="lblUser" runat="server"></asp:Label>
</div>
<div class="user-info">
<asp:Label ID="lblDt" runat="server" ></asp:Label>
</div>
</div>
<!--- Divider -->
<div id="sidebar-menu">
<ul>
<li class="has_sub">
<a class="waves-effect" href="#"><i class="fa fa-users"></i><span> User Creation </span><span class="pull-right"><i class="md md-add"></i></span></a>
<ul class="list-unstyled" style="">
<li><a href="RegisteredUsers.aspx">Registered Users</a></li>
<li><a href="Create_usrNew.aspx">Create User</a></li>
<li><a href="#">Allow Permission</a></li>
<li><a href="#">Update User</a></li>
</ul>
</li>
<li class="has_sub">
<a class="waves-effect" href="#"><i class="fa fa-users"></i><span> Menu </span><span class="pull-right"><i class="md md-add"></i></span></a>
<ul class="list-unstyled" style="">
<li><a href="#">Create Branch</a></li>
<li><a href="#">Create Course</a></li>
<li><a href="#">Set Course Fees</a></li>
</ul>
</li>
<li>
<a class="waves-effect" href="Default.aspx"><i class="fa fa-user"></i><span> Logout </span></a>
</li>
</ul>
<div class="clearfix"></div>
</div>
<div class="clearfix"></div>
</div>
</div>
<!-- Left Sidebar End -->
<div >
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server" >
</asp:ContentPlaceHolder>
</div>
<footer class="footer text-right">
Powered By Astonish Technology.
</footer>
<script>
var resizefunc = [];
</script>
<!-- jQuery -->
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/waves.js"></script>
<script src="js/wow.min.js"></script>
<script src="js/jquery.nicescroll.js" type="text/javascript"></script>
<script src="js/jquery.scrollTo.min.js"></script>
<script src="assets/jquery-detectmobile/detect.js"></script>
<script src="assets/fastclick/fastclick.js"></script>
<script src="assets/jquery-slimscroll/jquery.slimscroll.js"></script>
<script src="assets/jquery-blockui/jquery.blockUI.js"></script>
<!-- CUSTOM JS -->
<script src="js/jquery.app.js"></script>
<script src="assets/tagsinput/jquery.tagsinput.min.js"></script>
<script src="assets/toggles/toggles.min.js"></script>
<script src="assets/timepicker/bootstrap-timepicker.min.js"></script>
<script src="assets/timepicker/bootstrap-datepicker.js"></script>
<script type="text/javascript" src="assets/colorpicker/bootstrap-colorpicker.js"></script>
<script type="text/javascript" src="assets/jquery-multi-select/jquery.multi-select.js"></script>
<script type="text/javascript" src="assets/jquery-multi-select/jquery.quicksearch.js"></script>
<script src="assets/bootstrap-inputmask/bootstrap-inputmask.min.js" type="text/javascript"></script>
<script type="text/javascript" src="assets/spinner/spinner.min.js"></script>
<script src="assets/select2/select2.min.js" type="text/javascript"></script>
<script>
jQuery(document).ready(function () {
// Tags Input
jQuery('#tags').tagsInput({ width: 'auto' });
// Form Toggles
jQuery('.toggle').toggles({ on: true });
// Time Picker
jQuery('#timepicker').timepicker({ defaultTIme: false });
jQuery('#timepicker2').timepicker({ showMeridian: false });
jQuery('#timepicker3').timepicker({ minuteStep: 15 });
// Date Picker
jQuery('#datepicker').datepicker();
jQuery('#datepicker-inline').datepicker();
jQuery('#datepicker-multiple').datepicker({
numberOfMonths: 3,
showButtonPanel: true
});
//colorpicker start
$('.colorpicker-default').colorpicker({
format: 'hex'
});
$('.colorpicker-rgba').colorpicker();
//multiselect start
$('#my_multi_select1').multiSelect();
$('#my_multi_select2').multiSelect({
selectableOptgroup: true
});
$('#my_multi_select3').multiSelect({
selectableHeader: "<input type='text' class='form-control search-input' autocomplete='off' placeholder='search...'>",
selectionHeader: "<input type='text' class='form-control search-input' autocomplete='off' placeholder='search...'>",
afterInit: function (ms) {
var that = this,
$selectableSearch = that.$selectableUl.prev(),
$selectionSearch = that.$selectionUl.prev(),
selectableSearchString = '#' + that.$container.attr('id') + ' .ms-elem-selectable:not(.ms-selected)',
selectionSearchString = '#' + that.$container.attr('id') + ' .ms-elem-selection.ms-selected';
that.qs1 = $selectableSearch.quicksearch(selectableSearchString)
.on('keydown', function (e) {
if (e.which === 40) {
that.$selectableUl.focus();
return false;
}
});
that.qs2 = $selectionSearch.quicksearch(selectionSearchString)
.on('keydown', function (e) {
if (e.which == 40) {
that.$selectionUl.focus();
return false;
}
});
},
afterSelect: function () {
this.qs1.cache();
this.qs2.cache();
},
afterDeselect: function () {
this.qs1.cache();
this.qs2.cache();
}
});
//spinner start
$('#spinner1').spinner();
$('#spinner2').spinner({ disabled: true });
$('#spinner3').spinner({ value: 0, min: 0, max: 10 });
$('#spinner4').spinner({ value: 0, step: 5, min: 0, max: 200 });
//spinner end
// Select2
jQuery(".select2").select2({
width: '100%'
});
});
</script>
</form>
</body>
</html>
在另一个.aspx页面中调用master,我有一个文本框和一个radiobutton。当我尝试验证或保存记录时,文本框返回空白值。 .aspx在下面给出
<%@ Page Language="VB" MasterPageFile="~/Admin.master" AutoEventWireup="true" CodeFile="Create_usrNew.aspx.vb" Inherits="Create_usrNew" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
div class="content-page">
<!-- Start content -->
<div class="content">
<div class="container">
<div class="row">
<!-- Basic example -->
<div class="col-md-12">
<%--<asp:Label ID="lblerr" runat="server" class="fa fa-lock m-r-5" ForeColor="Red"></asp:Label>--%>
<div class="panel panel-default">
<%--<div class="panel-heading"><h3 class="panel-title">Add User</h3></div>--%>
<div class="panel-body">
<%--<form role="form">--%>
<div class="col-md-6"></div>
<div class="col-md-6">
<div class="form-group">
<label for="">User Name</label>
<asp:TextBox ID="txtUserName" runat="server" placeholder="Create User Name" EnableViewState= "false" Class="form-control" ></asp:TextBox>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="">Password</label>
<asp:TextBox ID="txtpwd" runat="server" placeholder="Password" CssClass="form-control" ></asp:TextBox>
</div>
</div>
<div class="col-md-6"></div>
<div class="col-md-2">
<div class="radio radio-info radio-inline">
<asp:RadioButtonList ID="rdbtnstate1" runat="server" AutoPostback ="true"
RepeatDirection="Horizontal" TextAlign="Right">
<asp:ListItem Text=" Branch" Value="2"></asp:ListItem>
<asp:ListItem Text=" Student" Value="3"></asp:ListItem>
</asp:RadioButtonList>
</div>
</div>
<div class="col-md-6"></div>
<div class="col-md-6">
<div class="form-group">
<%--<asp:Button ID="btnsave" runat="server" Text="Save" class="btn btn-success waves-effect waves-light" Onclick="btnsave_Click"/>
<asp:Button ID="btncancel" runat="server" Text="Cancel" class="btn btn-success waves-effect waves-light" OnClick="btncancel_Click" />--%>
<asp:LinkButton ID="LinkButton1" runat="server">Save</asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server">Cancel</asp:LinkButton>
</div>
</div>
<%--</form>--%>
<asp:Label ID="lblerr" runat="server" class="fa fa-lock m-r-5" ForeColor="Red"></asp:Label>
</div><!-- panel-body -->
</div> <!-- panel -->
</div> <!-- col-->
</div>
</div> <!-- container -->
</div> <!-- content -->
</div>
</asp:Content>
代码文件如下
Partial Class Create_usrNew
Inherits System.Web.UI.Page
Dim cmn As New clsComn
Dim db As New clsDB
Dim err As Integer = 0
Dim usrname As String = ""
Dim pword As String = ""
Dim dtcreat As DateTime
Dim usrtyp As Integer = 0
Dim selec As Integer = 0
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1))
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.Cache.SetNoStore()
If (Not IsPostBack) Then
If Session("uname") <> "" Then
Session("Moduleid") = 1
If (db.GetPermission(CInt(Session("usrid")), Session("Moduleid"), 1) = -1) Or (db.GetPermission(CInt(Session("usrid")), Session("Moduleid"), 2) = -1) Or (db.GetPermission(CInt(Session("usrid")), Session("Moduleid"), 3) = -1) Or (db.GetPermission(CInt(Session("usrid")), Session("Moduleid"), 4) = -1) Then
Else
lblerr.Text = "You Are Not Authorised in this Module. Contact Admin"
Response.Redirect("~/RegisteredUsers.aspx")
End If
Else
Response.Redirect("~/Default.aspx")
End If
txtpwd.Enabled = False
clear()
rdbtnstate1.SelectedValue = 2
End If
End Sub
Private Function verify() As Integer
Dim err As Integer = 0
If txtUserName.Text = "" Then
lblerr.Text = "User Name Cannot be Blank"
err = -1
End If
If rdbtnstate1.SelectedValue = "" Then
lblerr.Text = "Either of the Selection Has to be Made"
err = -1
End If
Dim sql As String = "Select count(Usrid) from Usertable where [UsrName]='" + txtUserName.Text + "'"
If db.SelectData_sql(sql) = 0 Then
Else
lblerr.Text = "Username Already Exists"
err = -1
End If
If Session("usrid") = 2 Then
If rdbtnstate1.SelectedValue = 2 Then
lblerr.Text = "You Are Not Authorised to Create Branch"
err = -1
End If
End If
Return err
End Function