|
Hi i am new to dot net i have a question that how does an aspx page executes without an error even after removing page load method.
Thanks in advance.
|
|
|
|
|
Because of the framework - your page inherits from the common page that has a default Load event handler...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
|
Am working in 3 tier architecture in asp.net.i wanted to learn mvc and which version i will start first (mvc 1,2,3,etc).which is the best way to study mvc in asp.net.
|
|
|
|
|
Video tutorials are the best.
If you can spend few dollars then go with Pluralsight. The best way of learning, as per my experience
http://www.pluralsight.com/training/Courses#aspdotnet
There ASP.Net MVC official site is also very good. Step by step Walk through step.
http://www.asp.net/mvc/tutorials/mvc-5/introduction/getting-started
Search in Code project articles. There are plenty of articles. Follow these tutorials and try to build an application from the ground, is the best way to learn.
I am currently working with MVC 4. I recommend you to start with MVC 5 which is almost an year old.
Good luck.
|
|
|
|
|
Thank u Mr Swinkaran
|
|
|
|
|
|
Hi folks, can someone please help, I have been going round in circles with this and I’m new to ASP & C#.
Could someone please create a basic example of how to display a web user controls i.e. dropdown lists on one page and the results displaced on a second page within a Gridview.
I have store proc for the GridView, big thanks as I am losing the plot here!!!
USE [TyreSannerSQL]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Procedure [dbo].[SearchResults] @Width int, @Profile int, @Diamete int, @Speed nvarchar, @CustPostcode nvarchar (50)
As
Begin
SELECT Suppliers.SupplierID, Suppliers.SupplierName, Product.Width, Product.Profile, Product.Diamete, Product.Speed, Product.Brand, Product.TyreModel, Product.TyreType,
Product.RollingResistance, Product.WetGrip, Product.NoiseEmission, Product.ProductUnitSalePrice
FROM Product INNER JOIN
Suppliers ON Product.SupplierFK = Suppliers.SupplierID
WHERE Width = @Width
and Product.Profile = @Profile
and Product.Diamete = @Diamete
and (Product.Speed = @Speed
or COALESCE(@Speed,'') = '')
and Suppliers.SupplierDistrict = LEFT(@CustPostcode,2)
ORDER BY Product.ProductUnitSalePrice ASC
End
|
|
|
|
|
When the dropdown changes you can use Response.Redirect("") to go to the page with the grid and pass the parameters through the query string.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I am working on a MVC Json web service and in the web service I am making a call to Active directory. What I need to do is determine, in my code, all possible common, non-exception, types of login return values possible when an AD user attempts to login. Also, where can I find a list of all common login errors (i.e. User Not Found, etc.) and how to access the login error type in my json web service.
modified 15-Sep-14 22:25pm.
|
|
|
|
|
hello, i have ASP.net source code but i cant run it with (IIS)8, it says i don't have full permission in web.config file...And I did a lot of possible thins to fix it right but it couldnt...i would appreciate any help
|
|
|
|
|
You really need to post the exact error message.
It's usually from not setting the file permissions on the disk drive for IIS_ANONYMOUS and the app_pool identity.
You really need to search for setting permissions, the AppPool\YouNameHere is the name of the application pool, in which you go tot he IIS Manager and look up the name, or it's the name of the website you made.
[EDIT]
If your web server is a member of a domain, you should unlink it before using the code below, then relink it when done.
icacls.exe test.txt /grant "IIS AppPool\DefaultAppPool":(OI)(CI)M
cmd /c icacls test.txt /grant "IIS AppPool\DefaultAppPool:(OI)(CI)M"
You should Google the above and read up on it before applying the command, so you get the exact result you want. or else you'll have to go back and delete a bad idea to keep your site secure. Just search icals.exe
You also have to setup permissions for IIS_Anonymous for read only. I searched for a link for that
https://adminspeak.wordpress.com/tag/iis-7-5-best-practices/[^]
|
|
|
|
|
|
Hi,
I have freelance job which is about an online food order. Someone who wants to order food have to be registired. I want to add registered users to the role "member". I can handle the registiration process but I cannot add to the role member.
How can I achieve this?
I've searched but couldn't find it.
|
|
|
|
|
|
Thanks for your reply actually I tried a similar method this:
Roles.AddUsersToRoles
However that gave en exception. Until you've posted me, I did not realize your suggest.
Thanks for your help.
|
|
|
|
|
Hi,
First up, I have spent the past 2 days Googling this one. I have found many, many "solutions" but I can't get any of them to work. Part of the problem is that the solutions say to use this code or that, but don't say WHERE to put it!
So, here is the situation.
I have a page, using a Master page. I have a TreeView on the left and an Update Panel on the right. When the user selects a node in the TreeView, I add a user control to the Update Panel. (The control depends upon the type of the node - internal to my App.)
This works.
BUT, I have the need to enter a date in a User Control. I tried to use the standard Calendar control, but for some reason it's SelectedDate property isn't being updated. I then tried the JQuery-UI DatePicker tied to a text box, but it never pops up.
I know it has something to do with the AJAX reload of the Panel happening after the control is registered, but...
Anyway, if anyone can explain how to do it (not just what code to use, but WHERE to place it ) I'd be eternally grateful!
Here is what I have (I have a Calendar control in there too. Getting either to work would make me VERY happy!):
Site.Master:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="Shedulinator.SiteMaster" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
<! While developing! >
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<! End dev bit>
<title>Interactive Intelligence Education Department Schedulinator</title>
<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder ID="HeadContent" runat="server">
<script src="Scripts/jquery-2.1.1.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-1.11.1.js" type="text/javascript"></script>
</asp:ContentPlaceHolder>
<script type="text/javascript">
$(document).ready(function () {
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args) {
$('.SiteDatePicker').datepicker({ dateFormat: 'dd-mm-yy' });
}
});
</script> </head>
<body>
<form runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div class="page">
<div class="header">
<div class="title">
<h1>
Page Title
</h1>
</div>
<div class="loginDisplay">
<asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
<AnonymousTemplate>
[ <a href="~/Account/Login.aspx" ID="HeadLoginStatus" runat="server">Log In</a> ]
</AnonymousTemplate>
<LoggedInTemplate>
Welcome <span class="bold"><asp:LoginName ID="HeadLoginName" runat="server" /></span>!
[ <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Log Out" LogoutPageUrl="~/"/> ]
</LoggedInTemplate>
</asp:LoginView>
</div>
</div>
<div class="main">
<asp:ContentPlaceHolder ID="MainContent" runat="server"/>
</div>
<div class="clear">
</div>
</div>
<div class="footer">
</div>
</form>
</body>
</html>
User Control:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CourseEditor.ascx.cs"
Inherits="Shedulinator.TheSettings.CourseEditor" %>
<% if (false)
{ %>
<link rel="Stylesheet" type="text/css" href="../Styles/Site.css" />
<% } %> <script type="text/javascript">
$(function () {
$('#<%=TextBoxGoLive.ClientID %>').datepicker();
});
</script>
<asp:Panel ID="Panel1" runat="server" CssClass="SettingsFormPanel">
<asp:Table ID="Table1" runat="server">
<asp:TableRow runat="server">
<asp:TableCell runat="server" RowSpan="6">
<asp:Image ID="Image1" runat="server" ImageUrl="~/Images/106660-3d-glossy-orange-orb-icon-transport-travel-compass2.png"
CssClass="SettingsIcon" />
</asp:TableCell>
<asp:TableCell runat="server">
<asp:Label ID="CourseRegion" runat="server" Text="Course Title:"></asp:Label></asp:TableCell>
<asp:TableCell runat="server">
<asp:TextBox ID="TextBoxCourseTitle" runat="server"></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<asp:Label ID="LabelDuration" runat="server" Text="Duration"></asp:Label></asp:TableCell>
<asp:TableCell runat="server">
<asp:TextBox ID="TextBoxDuration" runat="server"></asp:TextBox>
</asp:TableCell></asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<asp:Label ID="LabelDayLength" runat="server" Text="Day Length"></asp:Label></asp:TableCell><asp:TableCell
runat="server">
<asp:TextBox ID="TextBoxDayLength" runat="server"></asp:TextBox>
</asp:TableCell></asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<asp:Label ID="LabelIsVirtual" runat="server" Text="Web Based"></asp:Label></asp:TableCell><asp:TableCell
runat="server">
<asp:CheckBox ID="CheckBoxIsVirtual" runat="server" /></asp:TableCell></asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<asp:Label ID="LabelGoLive" runat="server" Text="Go Live"></asp:Label></asp:TableCell><asp:TableCell
runat="server">
<asp:TextBox ID="TextBoxGoLive" runat="server" CssClass="SiteDatePicker"></asp:TextBox>
</asp:TableCell></asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<asp:Label ID="LabelRetiredFrom" runat="server" Text="Retired From"></asp:Label></asp:TableCell><asp:TableCell
runat="server">
<asp:Calendar ID="CalendarRetired" runat="server" BackColor="White"></asp:Calendar>
</asp:TableCell></asp:TableRow>
</asp:Table>
<asp:Button ID="ButtonCancel" runat="server" CssClass="SettingsButton" Text="Cancel"
OnClick="ButtonCancel_Click" />
<asp:Button ID="ButtonOK" runat="server" CssClass="SettingsButton" Text="OK" OnClick="ButtonOK_Click" />
</asp:Panel>
Code behind for User Control:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Shedulinator.TheSettings
{
public partial class CourseEditor : SettingsForm
{
public event EventHandler Submit;
public event EventHandler CancelClick;
protected void Page_Load(object sender, EventArgs e)
{
reload();
}
protected void reload()
{
int CourseID = 0;
if (ItemID != null)
{
CourseID = Int16.Parse(ItemID);
}
if (CourseID > 0)
{
Course c;
using (SchedulerDatabaseDataContext dc = new SchedulerDatabaseDataContext())
{
c = dc.Courses.Where(Course => Course.CourseID == CourseID).Single();
}
TextBoxCourseTitle.Text = c.CourseTitle;
TextBoxDayLength.Text = c.DayLength.ToString();
TextBoxDuration.Text = c.Duration.ToString();
CheckBoxIsVirtual.Checked = (c.IsVirtual == 'Y');
if (c.Retired == null)
{
CalendarRetired.VisibleDate = DateTime.Today;
CalendarRetired.SelectedDates.Clear();
}
else
{
CalendarRetired.VisibleDate = (DateTime)c.Retired;
CalendarRetired.SelectedDate = (DateTime)c.Retired;
}
}
else
{
TextBoxCourseTitle.Text = "";
TextBoxDayLength.Text = "8";
TextBoxDuration.Text = "5";
CheckBoxIsVirtual.Checked = false;
CalendarRetired.VisibleDate = DateTime.Today;
CalendarRetired.SelectedDates.Clear();
}
}
protected void ButtonCancel_Click(object sender, EventArgs e)
{
reload();
if (CancelClick != null)
{
CancelClick(this, new EventArgs());
}
}
protected void ButtonOK_Click(object sender, EventArgs e)
{
using (SchedulerDatabaseDataContext dc = new SchedulerDatabaseDataContext())
{
int CourseID = 0;
if (ItemID != null)
{
CourseID = Int16.Parse(ItemID);
}
Course c;
if (CourseID == -1)
{
c = new Course();
dc.Connection.Open();
Course C = dc.Courses.OrderByDescending(Course => Course.CourseID).FirstOrDefault();
c.CourseID = (null == C ? 0 : C.CourseID) + 1;
}
else
{
c = dc.Courses.Where(Course => Course.CourseID == CourseID).Single();
}
c.CourseTitle = TextBoxCourseTitle.Text;
c.Duration = int.Parse(TextBoxDuration.Text);
c.DayLength = int.Parse(TextBoxDayLength.Text);
c.IsVirtual = (CheckBoxIsVirtual.Checked ? 'Y' : 'N');
if (CalendarRetired.SelectedDates.Count>0)
{
c.Retired = CalendarRetired.SelectedDate;
}
if (CourseID == -1)
{
dc.Courses.InsertOnSubmit(c);
}
dc.SubmitChanges();
}
if (Submit != null)
{
Submit(this, new EventArgs());
}
}
}
}
Paul
|
|
|
|
|
Let's fix one thing at a time, so I'll tackle the datepicker
I didn't see an update panel, so if there is none, the try will catch the error and contrinue to load the script.
Make sure you place the code below in the web form's, content place holder and not the master page like in your example.
I personally don't like the jquery.ui everthing, and prefer to just load the core, and the datepicker.
I switched the way you discover the textbox to bind to from css to the actual id of the textbox, using a wildcard to filter anything the is prefixed in front of the actual ID name of the textbox, will is standard behavior for using an update panel, in which $CT100_ is prefixed.
WebForm.aspx
<asp:Content ID="HeadContent" ContentPlaceHolderID="HeadContent" runat="Server">
<script src="Scripts/jquery.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-core.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-datepicker.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
initializeBinding();
try {
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
}
catch (e) {
}
});
function EndRequestHandler(sender, args) {
initializeBinding();
}
function initializeBinding() {
$('[id*="TextBoxGoLive"]').datepicker({
autoSize: true
});
}
</script>
</asp:Content>
[EDIT]
Test the code on your dev machine, using internet explorer 9+, and press F12 in IE, and clickon the bug for Debug. IE will throw an error like the webdev highlighting the error in yellow and red, showing where the script failed and why.
Then fix the error and run it again.
[EDIT 2]
Fix the path of the scripts, by deleting them, and using the project explorer to drag the jquery file into the editor, in which the correct path will be generated for that page.
|
|
|
|
|
Thanks
Worked like a charm!
|
|
|
|
|
Cool deal!, guess I'm getting better at this. Your post had a lot of information to sift through, but overall in the end, it was quite simple.
i forget to tell you to add the CSS for the datepicker. Once again you just drag the files from solution explorer to the webform or master page. I recommend the Head Content place holder on the web form, to keep the page load times faster.
<link href="../styles/jquery/jquery.ui.css" rel="stylesheet" type="text/css" />
<link href="../styles/jquery/jquery.ui.datepicker.css" rel="stylesheet" type="text/css" />
Just my Opinion here,
Be careful of the update panel, and try not to ever use. I think its kind of evil the way it works, and will back fire on on you in live production deployment if not fully understood. I found it takes a lot of horse power to drive it when using SSL at the same time unless you have one of those new Xeon CPU's with built in AES instructions.
You should really just load all the user controls within div containers, and use jquery to toggle the CSS display value to block or none as you change your selection, and use the radio button list instead of the dropdown if you only have 2 or 5 choices.
|
|
|
|
|
Hello
I am getting the following error message:
Server Error in '/' Application.
The resource cannot be found.
Requested URL: /Account/success.aspx
This is a Web form which inserts field data into a MS Access database and redirects the user to a 'You have successfully registered page'.
Everything was working fine locally until I decided to personalise it to show 'JohnSmith, you have successfully registered'.
I did that by adding the following to my register.aspx.vb file:
Response.Redirect("success.aspx?Data=" & Server.UrlEncode(username.Text))
and this to my success.aspx.vb file:
'Partial Class success
'Inherits System.Web.UI.Page
'End Class
Public Class success
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
End Class
What could be the problem here, please?
Thanks!
|
|
|
|
|
Member 8761667 wrote: What could be the problem here, please? Well, the error is pretty clear. The page /Account/success.aspx does not exist.
When you do Response.Redirect you likely will want to go to the root of the app and make your path from there so that if you deploy under a different structure, the code will still work. All you likely need to do is add ~ to your Response.Redirect.
Response.Redirect("~/success.aspx?Data=" & Server.UrlEncode(username.Text))
~/ will move to the root of the site.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
That's great 8761667
Thank you.
The error has gone but for some reason the 'You have successfully registered' is still not personalised.
The script that I added I basically got from a Microsoft tutorial.
|
|
|
|
|
You're passing the username through the querystring but then never using it, at least not in the data you showed.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
How would I do that, Ryan? This is my first venture into asp.net.
|
|
|
|
|