Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

How to enable different modes in web parts

$
0
0

My .aspx file

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Index.aspx.vb" Inherits="Index" %>

<%@ Register src="LoginPage.ascx" tagname="LoginPage" tagprefix="uc1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:WebPartManager ID="wpManager" runat="server">
</asp:WebPartManager>
<br />

<br />
<table class="auto-style1">
<tr>
<td>
<asp:WebPartZone ID="WebPartZone1" runat="server" BorderColor="#CCCCCC" Font-Names="Verdana" Padding="6">
<ZoneTemplate>
<asp:Label ID="Lbl_UserName" title="Welcome" runat="server">Welcome</asp:Label>
</ZoneTemplate>
<MenuLabelHoverStyle ForeColor="#E2DED6" />
<MenuLabelStyle ForeColor="White" />
<MenuPopupStyle BackColor="#5D7B9D" BorderColor="#CCCCCC" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.6em" />
<MenuVerbHoverStyle BackColor="#F7F6F3" BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" ForeColor="#333333" />
<MenuVerbStyle BorderColor="#5D7B9D" BorderStyle="Solid" BorderWidth="1px" ForeColor="White" />
<TitleBarVerbStyle Font-Size="0.6em" Font-Underline="False" ForeColor="White" />
<EmptyZoneTextStyle Font-Size="0.8em" />
<HeaderStyle Font-Size="0.7em" ForeColor="#CCCCCC" HorizontalAlign="Center" />
<PartChromeStyle BackColor="#F7F6F3" BorderColor="#E2DED6" Font-Names="Verdana" ForeColor="White" />
<PartStyle Font-Size="0.8em" ForeColor="#333333" />
<PartTitleStyle BackColor="#5D7B9D" Font-Bold="True" Font-Size="0.8em" ForeColor="White" />
</asp:WebPartZone>
</td>
<td>
<asp:WebPartZone ID="WebPartZone2" HeaderText="Pick A Day" runat="server" BorderColor="#CCCCCC" Font-Names="Verdana" Padding="6">
<ZoneTemplate>
<asp:Label ID="Lbl_Date" runat="server" Text="Day" Font-Bold="True" Font-Italic="True" Font-Names="AngsanaUPC" ForeColor="Black"></asp:Label>
<asp:Calendar ID="Calendar1" runat="server"></asp:Calendar>
</ZoneTemplate>
<MenuLabelHoverStyle ForeColor="#E2DED6" />
<MenuLabelStyle ForeColor="White" />
<MenuPopupStyle BackColor="#5D7B9D" BorderColor="#CCCCCC" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.6em" />
<MenuVerbHoverStyle BackColor="#F7F6F3" BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" ForeColor="#333333" />
<MenuVerbStyle BorderColor="#5D7B9D" BorderStyle="Solid" BorderWidth="1px" ForeColor="White" />
<TitleBarVerbStyle Font-Size="0.6em" Font-Underline="False" ForeColor="White" />
<EmptyZoneTextStyle Font-Size="0.8em" />
<HeaderStyle Font-Size="0.7em" ForeColor="#CCCCCC" HorizontalAlign="Center" />
<PartChromeStyle BackColor="#F7F6F3" BorderColor="#E2DED6" Font-Names="Verdana" ForeColor="White" />
<PartStyle Font-Size="0.8em" ForeColor="#333333" />
<PartTitleStyle BackColor="#5D7B9D" Font-Bold="True" Font-Size="0.8em" ForeColor="White" />
</asp:WebPartZone>
</td>
<td>
<asp:WebPartZone ID="WebPartZone3" runat="server">
<ZoneTemplate>
<uc1:LoginPage ID="LoginPage1" runat="server" />
</ZoneTemplate>
</asp:WebPartZone>
</td>
</tr>
</table>

</div>
</form>
</body>
</html>

Code Behind File: 

in Vb.net

Partial Class Index
Inherits System.Web.UI.Page

Protected Sub Page_Init(sender As Object, e As EventArgs)

End Sub
Protected Sub Page_Load(sender As Object, e As EventArgs)

End Sub

Protected Sub Calendar1_SelectionChanged(sender As Object, e As EventArgs) Handles Calendar1.SelectionChanged
Lbl_Date.Text = Calendar1.SelectedDate

End Sub
End Class

Login Page:

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="LoginPage.ascx.vb" Inherits="LoginPage" %>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>
<link rel="stylesheet" type="text/css" href="CSS/LoginPage.css" />
<div id="tablelogin">
<table class="auto-style1">
<tr>
<td colspan="2">
<asp:Label ID="Lbl_Login" runat="server" Text="Login"></asp:Label>
</td>

</tr>
<tr>
<td>
<asp:Label ID="Lbl_UserName" runat="server" Text="UserName"></asp:Label>
</td>
<td>
<asp:TextBox ID="Txt_UserName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>
<asp:Label ID="Lbl_Password" runat="server" Text="Password"></asp:Label>
</td>
<td>
<asp:TextBox ID="Txt_Password" runat="server" TextMode="Password"></asp:TextBox>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<asp:Button ID="btn_Submit" runat="server" Text="Submit" />
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<asp:Label ID="Lbl_Chck" runat="server" Text="Label" Visible="False"></asp:Label>
</td>
</tr>
</table>
</div>

Login Page Code Behind File:

Imports System.Data
Imports System.Data.Sql
Imports System.Data.SqlClient
Partial Class LoginPage
Inherits System.Web.UI.UserControl

Protected Sub btn_Submit_Click(sender As Object, e As EventArgs) Handles btn_Submit.Click
Dim con As New SqlClient.SqlConnection("Data Source=ADMIN2-PC;Initial Catalog=aspnetdb; User ID=sa;Password=sql123")
Dim cmd As New SqlClient.SqlCommand
Dim adp As New SqlClient.SqlDataAdapter
Dim dataset As New DataSet
cmd.CommandText = "SELECT * FROM T_Check WHERE C_UserName='" & Txt_UserName.Text & "' AND C_Password='" & Txt_Password.Text & "';"
con.Open()
cmd.Connection = con
adp.SelectCommand = cmd
adp.Fill(dataset, "0")
Dim count = dataset.Tables(0).Rows.Count
If count > 0 Then
Lbl_Chck.Visible = True
Lbl_Chck.Text = "Login Successful"
Else
Lbl_Chck.Visible = True
Lbl_Chck.Text = "Login Failed"
End If
Txt_UserName.Text = ""
Txt_Password.Text = ""
End Sub
End Class




My web config

<configuration>
<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=ADMIN2-PC;Initial Catalog=aspnetdb; User ID=sa;Password=sql123" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
<authentication mode="Windows"/>
</system.web>
</configuration>

i have checked with authentication mode disabled and windows authentication enabled it asks for password and after entering it says you are not authorised.

i have checked every possibilities available in the net. and i am newbie to this. for me only browse mode is enable how can i enable design mode edit and all the other modes please help.


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>