Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 30th, 2005, 06:32 AM
Friend of Wrox
Points: 686, Level: 9
Points: 686, Level: 9 Points: 686, Level: 9 Points: 686, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2005
Location: Kolkata, West Bengal, India.
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default Exception:Page Not found

Hi everyone!!

I have a C# project which has few aspx pages and few HTML pages as template. There is a page called home.aspx which has a single line of code inheriting the home.html from the templates folder. The codebehind references a .cs page called pageweb.cs. My problem is that when I am running the aspx page an exception occurs saying that the .html page was not found. The solution to this project was build without any error but still this problem appears. I am putting the code for the pages below"

home.aspx
-----------
<%@ Page language="c#" Codebehind="pageweb.cs" AutoEventWireup="false" Inherits="ameandlulu.home" %>


pageweb.cs
------------

<html><body>using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
//using Webpage;
using SimpleWebpage;

namespace ameandlulu {
    public class pageweb : System.Web.UI.Page {
        Formpage m_formpage = null;

        protected Formpage formpage{
            get{return m_formpage;}
            set{m_formpage = value;}
        }

        private void Page_Load(object sender, System.EventArgs e) {
            LoadPage();
        }

        override protected void OnInit(EventArgs e) {
            InitializeComponent();
            base.OnInit(e);
        }

        private void InitializeComponent() {
            this.Load += new System.EventHandler(this.Page_Load);
        }

        protected string FormatUspInputParam(string strInputParamName, string strCharType, string strInputParamValue){
            if (strInputParamValue==null)
                return "";
            return string.Format("@{0}={1}{2}{3},",strInputParamName, strCharType,strInputParamValue.Replace("'","''"),s trCharType);
        }

        protected void SendingEmail(string strTo, string strSubject, string strEmailBody){
            System.Web.Mail.MailMessage oMessage = new System.Web.Mail.MailMessage();
            oMessage.From = "amye@abc.com";
            oMessage.To = strTo;
            oMessage.Subject = strSubject;
            oMessage.BodyFormat = System.Web.Mail.MailFormat.Html;
            oMessage.Body = strEmailBody;
            oMessage.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"] = 2;
            oMessage.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"] = "mail.abc.com";
            oMessage.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = "amye@abc.com";
            oMessage.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = "mon";
            oMessage.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1;
            System.Web.Mail.SmtpMail.SmtpServer = "mail.ameandlulu.com";

            System.Web.Mail.SmtpMail.Send(oMessage);
        }

        protected void SetPageValue(Formpage page){
            page.OrderID = Session["OrderID"] as String;
[s]           Match match = new Regex(@"http ?://[\w\.]+(?=/)",RegexOptions.IgnoreCase).Match(Request.Url.Abso luteUri);
            string dbserver;
            if (Regex.Match(match.Value,"ameandlulu",RegexOptions .IgnoreCase).Success){
                dbserver = "abc.bcd.com";
            }else{
[s]               dbserver = Regex.Match(match.Value,@"(?<=http ?://)\w+(?=.*)",RegexOptions.IgnoreCase).Value;
            }
            page.TemplatePath = match.Value+"/Templates/";
            page.ConnectionString = string.Format("server={0};User id=akur;password=son;database=mon",dbserver);
        }

        private void LoadPage(){
            StringWriter sw = new StringWriter();
            Console.SetOut(sw);
            if (RequestHasError()){
                Response.Write(GetErrorDesc());
                return;
            }
            formpage = Getpage();
            SetPageValue(formpage);
            Initialize();
            try
            {
                Response.Write(formpage.RenderPage());
            }
            catch(Exception ex)
            {
                Console.WriteLine("!!!Exception Occured!!!");
                Console.WriteLine(ex.Message);
                Response.Write(sw.ToString());
            }
        }

        protected virtual bool RequestHasError(){
            return false;
        }

        protected virtual string GetErrorDesc(){
            throw new NotImplementedException("Please Implement override GetErrorDesc method!");
        }

        protected virtual void Initialize(){
            //default
        }

        protected virtual Formpage Getpage(){
            throw new NotImplementedException("Please Implement override Getpage method!");
        }
    }


    public class home : pageweb {
        protected override Formpage Getpage(){
            return new Homepage();
        }
    }

    public class collection : pageweb {
        protected override Formpage Getpage(){
            return new Collectionpage();
        }
    }

    public class about : pageweb {
        protected override Formpage Getpage(){
            return new Aboutpage();
        }
    }

    public class press : pageweb {
        protected override Formpage Getpage(){
            return new Presspage();
        }
    }

    public class pressdetail : pageweb {
        protected override void Initialize(){
            string strPictureLink = Request.QueryString["PictureLink"];

            Pressdetailpage pressdetailpage = (Pressdetailpage)formpage;
            pressdetailpage.PictureLink = strPictureLink;
        }

        protected override Formpage Getpage(){
            return new Pressdetailpage();
        }
    }

    public class retailer : pageweb {
        protected override Formpage Getpage(){
            return new Retailerpage();
        }
    }

    public class monogramming : pageweb {
        protected override Formpage Getpage(){
            return new Monogrammingpage();
        }
    }

    public class contact : pageweb {
        protected override Formpage Getpage(){
            return new Contactpage();
        }
    }

    public class contactresult : pageweb {
        protected override bool RequestHasError(){
            return Request.HttpMethod.ToUpper()!="POST";
        }

        protected override string GetErrorDesc(){
            return "POST Error";
        }

        protected override void Initialize(){
            string strEmail = Request.Form["Email"];
            string strFirstName = Request.Form["FirstName"];
            string strLastName = Request.Form["LastName"];
            string strAddress1 = Request.Form["Address1"];
            string strAddress2 = Request.Form["Address2"];
            string strCity = Request.Form["City"];
            string strState = Request.Form["State"];
            string strZipCode = Request.Form["ZipCode"];
            string strContactMessage = Request.Form["ContactMessage"];

            StringBuilder sb = null;
            sb = new StringBuilder();
            sb.Append("exec usp_AddUpdContactByContactID ");
            sb.Append("@ContactID=NULL,");
            sb.Append(FormatUspInputParam("Email","'",strEmail ));
            sb.Append(FormatUspInputParam("FirstName","'",strF irstName));
            sb.Append(FormatUspInputParam("LastName","'",strLa stName));
            sb.Append(FormatUspInputParam("Address1","'",strAd dress1));
            sb.Append(FormatUspInputParam("Address2","'",strAd dress2));
            sb.Append(FormatUspInputParam("City","'",strCity)) ;
            sb.Append(FormatUspInputParam("State","'",strState ));
            sb.Append(FormatUspInputParam("ZipCode","'",strZip Code));
            sb.Append(FormatUspInputParam("ContactMessage","'" ,strContactMessage));
            formpage.ChangeData(sb.ToString().TrimEnd(','));

            Messagepage messagepage = (Messagepage)formpage;
            messagepage.ContentText = "Thank you!";

            string strTo = "amye@abc.com";
            string strSubject = string.Format("Contact request from {0} {1}",strFirstName,strLastName);
            StringWriter sw = new StringWriter();
            sw.WriteLine("");
            sw.WriteLine("");
            sw.WriteLine("<b>From:</b><br>");
            sw.WriteLine("{0} {1}<br>",strFirstName,strLastName);
            sw.WriteLine("{0}<br>",strAddress1);
            if (strAddress2!="")
                sw.WriteLine("{0}<br>",strAddress2);
            sw.WriteLine("{0}, {1} {2}<br>",strCity,strState,strZipCode);
            sw.WriteLine("<b>Email:</b>{0}<br>",strEmail);
            sw.WriteLine("<p>{0}</p>",strContactMessage);
            sw.WriteLine("");
            sw.WriteLine("");
            string strEmailBody = sw.ToString();
            sw.Close();

            SendingEmail(strTo,strSubject,strEmailBody);
        }

        protected override Formpage Getpage(){
            return new Messagepage();
        }
    }

    #region list
    public class listgolfheadcover : pageweb {
        protected override Formpage Getpage(){
            return new ListGolfHeadcoverpage();
        }
    }

    public class listtennisbag : pageweb {
        protected override Formpage Getpage(){
            return new ListTennisBagpage();
        }
    }

    public class listyogabag : pageweb {
        protected override Formpage Getpage(){
            return new ListYogaBagpage();
        }
    }

    public class listshoebag : pageweb {
        protected override Formpage Getpage(){
            return new ListShoeBagpage();
        }
    }

    public class listteebag : pageweb {
        protected override Formpage Getpage(){
            return new ListTeeBagpage();
        }
    }

    public class listbarrelbag : pageweb {
        protected override Formpage Getpage(){
            return new ListBarrelBagpage();
        }
    }

    public class listshirt : pageweb {
        protected override Formpage Getpage(){
            return new ListShirtpage();
        }
    }
    public class listgolfbelt : pageweb
    {
        protected override Formpage Getpage()
        {
            return new ListGolfBeltpage();
        }
    }
    #endregion

}
</body></html>

-------------------------------------------------------------------

WebpageMain
-----------

using System;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Collections;
using System.Net;

namespace SimpleWebpage
 {
    public class Formpage {
        private string m_OrderID = null;
        private string m_FormOpen = null;
        private string m_ConnectionString = null;
        private string m_TemplateFileStream = null;
        private string m_TemplateContent = null;
        private string m_TemplatePath = null;

        public string OrderID{
            get{
                return m_OrderID;
            }
            set{
                m_OrderID = value;
            }
        }

        public string FormOpen{
            get{
                return m_FormOpen;
            }
            set{
                m_FormOpen = value;
            }
        }

        public string ConnectionString{
            get{
                return m_ConnectionString;
            }
            set{
                m_ConnectionString = value;
            }
        }

        #region Template & Content
        protected virtual string TemplateFile{
            get{
                throw new NotImplementedException("Please Implement override TemplateFile property!");
            }
        }

        protected string TemplateFileStream{
            get{
                return m_TemplateFileStream;
            }
            set{
                m_TemplateFileStream = value;
            }
        }

        protected string TemplateContent{
            get{
                return m_TemplateContent;
            }
            set{
                m_TemplateContent = value;
            }
        }

        public string TemplatePath{
            get{
                return m_TemplatePath;
            }
            set{
                m_TemplatePath = value;
            }
        }
        #endregion
        protected string UspViewShoppingCartSummary{
            get{
                return string.Format("exec usp_GetOrderItemSummaryByOrderID @OrderID = '{0}'",OrderID);
            }
        }

        public virtual string RenderPage(){
            throw new NotImplementedException("Please Implement override RenderPage method!");
        }

        protected string FormatCurrency(string money){
            if (money=="") money = "0.0000";
            return Convert.ToDecimal(money).ToString("C");
        }

        protected string ReadFromURL(string urlname){
            StringWriter sw = new StringWriter();

            WebResponse myResponse = null;
            StreamReader din = null;
            try{
                myResponse = WebRequest.Create(urlname).GetResponse();
                din = new StreamReader(myResponse.GetResponseStream());
                sw.Write(din.ReadToEnd());
            }catch (WebException){
                myResponse = WebRequest.Create(urlname.Replace(".dwt",".html")) .GetResponse();
                din = new StreamReader(myResponse.GetResponseStream());
                sw.Write(din.ReadToEnd());
            }catch (Exception e){
                Console.WriteLine(urlname);
                Console.WriteLine(e.ToString());
            }finally{
                if (myResponse != null)
                    myResponse.Close();
                if (din != null)
                    din.Close();
            }

            return sw.ToString();
        }

        #region Regex
        protected string GetEditableRegionRegex(string editablename){
            string BeginTag = @"<!\-\- (Template|Instance)BeginEditable name="""+editablename+@""" \-\->";
            string EndTag = @"<!\-\- (Template|Instance)EndEditable \-\->";
            return BeginTag+".*?"+EndTag;
        }

        protected string GetEditableRegionRegex2(string editablename){
            string BeginTag = @"<!\-\- (Template|Instance)BeginEditable name="""+editablename+@""" \-\->";
            string EndTag = @"<!\-\- (Template|Instance)EndEditable \-\->";
            return BeginTag+".*"+EndTag;
        }

        protected string GetRepeatRegionRegex(string repeatname, int nestedlevel){
            string BeginTag = @"<!\-\- (Template|Instance)BeginRepeat name="""+repeatname+@""" \-\->";
            string EndTag = @"<!\-\- (Template|Instance)EndRepeat \-\->";
            StringBuilder sb = new StringBuilder();
            sb.Append(BeginTag);
            for(int i=0;i<=nestedlevel;i++){
                sb.AppendFormat(".*?{0}",EndTag);
            }
            return sb.ToString();
        }
        #endregion
        #region Database call
        public DataSet GetRowSetData(string usp){
            SqlConnection mySqlConnection = new SqlConnection(ConnectionString);
            SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter(usp, mySqlConnection);

            DataSet ds = null;
            try{
                ds = new DataSet();
                mySqlDataAdapter.Fill(ds, "ResultRowSet");
            }catch(Exception e){
                Console.Write(e.ToString());
                ds = null;
            }finally{
                if (mySqlConnection.State == ConnectionState.Open)
                    mySqlConnection.Close();
            }
            return ds;
        }

        public void ChangeData(string usp){
            SqlConnection mySqlConnection = new SqlConnection(ConnectionString);
            SqlCommand mySqlCommand = new SqlCommand(usp, mySqlConnection);

            try{
                mySqlConnection.Open();
                mySqlCommand.ExecuteNonQuery();
            }catch(Exception e){
                Console.Write(e.ToString());
            }finally{
                if (mySqlConnection.State == ConnectionState.Open)
                    mySqlConnection.Close();
            }
        }
        #endregion
    }

    public class Homepage : Formpage {
        protected override string TemplateFile{
            get{
                return "home.html";
            }
        }

        public override string RenderPage(){
            RegexOptions regexoptions = RegexOptions.Singleline | RegexOptions.ExplicitCapture;
            TemplateFileStream = ReadFromURL(TemplatePath+TemplateFile);

            //View shopping cart
            DataSet ds = GetRowSetData(UspViewShoppingCartSummary);
            if (ds.Tables[0].Rows.Count>0){
                DataRow dr = ds.Tables[0].Rows[0];
                TemplateFileStream = Regex.Replace(TemplateFileStream,GetEditableRegion Regex("orderitemnum"),dr["orderitemnum"].ToString(),regexoptions);
                TemplateFileStream = Regex.Replace(TemplateFileStream,GetEditableRegion Regex("total"),FormatCurrency(dr["total"].ToString()),regexoptions);
            }

            string strFormOpen = Regex.Match(TemplateFileStream,"<form.*?>").Value;
            if (FormOpen==null){
                FormOpen = strFormOpen;
            }
            // append FormOpen string
            FormOpen += string.Format("<input name=\"OrderID\" type=\"hidden\" value=\"{0}\">",OrderID);
            TemplateFileStream = TemplateFileStream.Replace(strFormOpen,FormOpen);

            return TemplateFileStream;
        }
    }

    public class Globalpage : Formpage {
        protected virtual string RenderTitle(){
            throw new NotImplementedException("Please Implement override RenderTitle method!");
        }
        protected virtual void RenderContent(){
            throw new NotImplementedException("Please Implement override RenderContent method!");
        }

        public override string RenderPage(){
            RegexOptions regexoptions = RegexOptions.Singleline | RegexOptions.ExplicitCapture;
            TemplateFileStream = ReadFromURL(TemplatePath+TemplateFile);

            string strFormOpen = Regex.Match(TemplateFileStream,"<form.*?>").Value;
            if (FormOpen==null){
                FormOpen = strFormOpen;
            }

            //View shopping cart
            DataSet ds = GetRowSetData(UspViewShoppingCartSummary);
            if (ds.Tables[0].Rows.Count>0){
                DataRow dr = ds.Tables[0].Rows[0];
                TemplateFileStream = Regex.Replace(TemplateFileStream,GetEditableRegion Regex("orderitemnum"),dr["orderitemnum"].ToString(),regexoptions);
                TemplateFileStream = Regex.Replace(TemplateFileStream,GetEditableRegion Regex("total"),FormatCurrency(dr["total"].ToString()),regexoptions);
            }
            TemplateFileStream = Regex.Replace(TemplateFileStream,GetEditableRegion Regex("title"),RenderTitle(),regexoptions);

            string strTemplateContent = Regex.Match(TemplateFileStream,"<table.*>/table>",regexoptions).Value;
            TemplateContent = strTemplateContent;
            RenderContent();
            TemplateFileStream = TemplateFileStream.Replace(strTemplateContent,Temp lateContent);

            // append FormOpen string
            FormOpen += string.Format("<input name=\"OrderID\" type=\"hidden\" value=\"{0}\">",OrderID);
            TemplateFileStream = TemplateFileStream.Replace(strFormOpen,FormOpen);
            //Console.Write(TemplateFileStream);
            return TemplateFileStream;
        }
    }

    public class Aboutpage : Globalpage {
        protected override string TemplateFile{
            get{
                return "about.dwt";
            }
        }
        protected override string RenderTitle(){
            return "About";
        }
        protected override void RenderContent(){
            return;
        }
    }
    #region Press
    public class Presspage : Globalpage {
        protected override string TemplateFile{
            get{
                return "press.dwt";
            }
        }
        protected override string RenderTitle(){
            return "Articles";
        }
        protected override void RenderContent(){
            return;
        }
    }

    public class Pressdetailpage : Globalpage {
        private string m_PictureLink = null;

        public string PictureLink{
            get{
                return m_PictureLink;
            }
            set{
                m_PictureLink = value;
            }
        }

        protected override string TemplateFile{
            get{
                return "pressdetail.dwt";
            }
        }
        protected override string RenderTitle(){
            return "";
        }
        protected override void RenderContent(){
            RegexOptions regexoptions = RegexOptions.Singleline | RegexOptions.ExplicitCapture;
            TemplateContent = Regex.Replace(TemplateContent,GetEditableRegionReg ex("presspicture"),string.Format("<img src=\"{0}\">",PictureLink),regexoptions);
        }
    }
    #endregion
    public class Retailerpage : Globalpage {
        protected override string TemplateFile{
            get{
                return "retailer.dwt";
            }
        }
        protected override string RenderTitle(){
            return "Retailers";
        }
        protected override void RenderContent(){
            return;
        }
    }
    public class Monogrammingpage : Globalpage {
        protected override string TemplateFile{
            get{
                return "monogramming.dwt";
            }
        }
        protected override string RenderTitle(){
            return "Monogramming";
        }
        protected override void RenderContent(){
            return;
        }
    }
    public class Contactpage : Globalpage {
        protected override string TemplateFile{
            get{
                return "contact.dwt";
            }
        }
        protected override string RenderTitle(){
            return "Contact";
        }
        protected override void RenderContent(){
            RegexOptions regexoptions = RegexOptions.Singleline | RegexOptions.ExplicitCapture;
            StringWriter sw = new StringWriter();
            sw.WriteLine(Regex.Replace(FormOpen,"(?<=<form.*?a ction=\").*?(?=\")","contactresult.aspx",regexopti ons));
            FormOpen = sw.ToString();
            sw.Close();
        }
    }
    public class Checkoutpage : Globalpage {
        protected override string TemplateFile{
            get{
                return "checkout.dwt";
            }
        }
        protected override string RenderTitle(){
            return "Checkout";
        }
        protected override void RenderContent(){
            RegexOptions regexoptions = RegexOptions.Singleline | RegexOptions.ExplicitCapture;
            StringWriter sw = new StringWriter();
            sw.WriteLine(Regex.Replace(FormOpen,"(?>=<form.*?a ction=\").*?(?=\")","checkoutresult.aspx",regexopt ions));
            FormOpen = sw.ToString();
            sw.Close();
        }
    }
    public class Messagepage : Globalpage {
        private string m_ContentText = null;

        public string ContentText{
            get{
                return m_ContentText;
            }
            set{
                m_ContentText = value;
            }
        }

        protected override string TemplateFile{
            get{
                return "message.dwt";
            }
        }
        protected override string RenderTitle(){
            return "";
        }
        protected override void RenderContent(){
            RegexOptions regexoptions = RegexOptions.Singleline | RegexOptions.ExplicitCapture;
            TemplateContent = Regex.Replace(TemplateContent,GetEditableRegionReg ex("contenttext"),ContentText,regexoptions);
        }
    }

    public class ViewCartpage : Globalpage {
        protected override string TemplateFile{
            get{
                return "viewcart.dwt";
            }
        }
        protected override string RenderTitle(){
            return "Shopping cart";
        }

        protected string UspViewShoppingCartDetail{
            get{
                return string.Format("exec usp_GetOrderItemByOrderID @OrderID = '{0}'",OrderID);
            }
        }

        protected override void RenderContent(){
            DataSet ds = GetRowSetData(UspViewShoppingCartDetail);
            DataRowCollection drc = ds.Tables[0].Rows;

            RegexOptions regexoptions = RegexOptions.Singleline | RegexOptions.ExplicitCapture;
            string strRowRepeatRegex = GetRepeatRegionRegex("viewcartlist",0);
            string strRowRepeat = Regex.Match(TemplateContent,strRowRepeatRegex,rege xoptions).Value;
            string strRowText = RenderRow(strRowRepeat,drc);
            TemplateContent = TemplateContent.Replace(strRowRepeat,strRowText);
            int iOrderItems = 0;
            decimal dSubtotal = 0;
            foreach (DataRow dr in drc){
                iOrderItems += Convert.ToInt32(dr["Quantity"].ToString());
                dSubtotal += Convert.ToDecimal(dr["Subtotal"].ToString());
            }
            if (iOrderItems==0)
                return;
            TemplateContent = Regex.Replace(TemplateContent,GetEditableRegionReg ex("subtotal2"),FormatCurrency(dSubtotal.ToString( )),regexoptions);
            TemplateContent = Regex.Replace(TemplateContent,GetEditableRegionReg ex("orderitems"),iOrderItems.ToString(),regexoptio ns);
            TemplateContent = Regex.Replace(TemplateContent,GetEditableRegionReg ex("shippingprice"),FormatCurrency(drc[0]["ShippingHandling"].ToString()),regexoptions);
            TemplateContent = Regex.Replace(TemplateContent,GetEditableRegionReg ex("tax"),FormatCurrency(drc[0]["Tax"].ToString()),regexoptions);
            TemplateContent = Regex.Replace(TemplateContent,GetEditableRegionReg ex("totalprice"),FormatCurrency(drc[0]["Total"].ToString()),regexoptions);

            StringWriter sw = new StringWriter();
            sw.WriteLine(Regex.Replace(FormOpen,"(?>=<form.*?a ction=\").*?(?=\")","viewcart.aspx",regexoptions)) ;
            sw.WriteLine(">input name=\"UpdateOrderItemID\" type=\"hidden\" value=\"\">");
            sw.WriteLine("<input name=\"RemoveOrderItemID\" type=\"hidden\" value=\"\">");
            FormOpen = sw.ToString();
            sw.Close();
        }

        protected string RenderRow(string strRowRepeat, DataRowCollection drc){
            int iCount = drc.Count;
            if (iCount==0)
                return string.Empty;

            RegexOptions regexoptions = RegexOptions.Singleline | RegexOptions.ExplicitCapture;
            StringBuilder sb = new StringBuilder();
            foreach (DataRow dr in drc){
                string strRowText = strRowRepeat;

                StringWriter sw = new StringWriter();
                sw.WriteLine("{0}<br>",string.Format("<b>{0} - <br>{1}</b>",dr["ProductCategoryName"].ToString(),dr["ProductName"].ToString()));
                if (dr["AdditionalInfo"].ToString()!=""){
                    sw.WriteLine("{0}<br>",dr["AdditionalInfo"].ToString());
                }
                if (dr["IsAddMonogramming"].ToString().ToUpper()=="TRUE"){
                    sw.WriteLine("MonogrammingText: {0}<br>",dr["MonogrammingText"].ToString());
                    sw.WriteLine("MonogrammingStyle: {0}<br>",dr["MonogrammingStyle"].ToString());
                    sw.WriteLine("MonogrammingSize: {0}<br>",dr["MonogrammingSize"].ToString());
                    sw.WriteLine("MonogrammingColor: {0}<br>",dr["MonogrammingColor"].ToString());
                }

                strRowText = Regex.Replace(strRowText,GetEditableRegionRegex("p roductname"),sw.ToString(),regexoptions);
                strRowText = Regex.Replace(strRowText,GetEditableRegionRegex("u nitprice"),FormatCurrency(dr["UnitPrice"].ToString()),regexoptions);

                string strQuantity = Regex.Match(strRowText,GetEditableRegionRegex("qua ntity"),regexoptions).Value;
                strQuantity = Regex.Replace(strQuantity,"(?<=<input.*?name=\")(? =.*?\")",dr["OrderItemID"].ToString()+"_");
                strQuantity = Regex.Replace(strQuantity,"(?>=<input.*?value=\"). *?(?=\")",dr["Quantity"].ToString());
                strRowText = Regex.Replace(strRowText,GetEditableRegionRegex("q uantity"),strQuantity,regexoptions);

                string strUpdate = Regex.Match(strRowText,GetEditableRegionRegex("upd ate"),regexoptions).Value;
                strUpdate = Regex.Replace(strUpdate,">a.*?>",string.Format("<a href=\"javascript:document.form1.UpdateOrderItemID .value='{0}';document.form1.submit();\">",dr["OrderItemID"].ToString()));
      &nbs
Reply With Quote
  #2 (permalink)  
Old November 30th, 2005, 07:14 AM
spc spc is offline
Registered User
 
Join Date: Nov 2005
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi arnab,
  I am not very sure about the solution. But check out whether you have missed the 'runat' attribute in any one of your tags. If so set it as 'runat="server"' in the title tag & try.
  Please let me know whether it worked for you or not.
Bye
spc

Reply With Quote
  #3 (permalink)  
Old December 1st, 2005, 03:00 AM
Friend of Wrox
Points: 686, Level: 9
Points: 686, Level: 9 Points: 686, Level: 9 Points: 686, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2005
Location: Kolkata, West Bengal, India.
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default

But where to use the runat=server tag. In the .aspx file or the .html file
Reply With Quote
  #4 (permalink)  
Old December 1st, 2005, 03:02 AM
Friend of Wrox
Points: 686, Level: 9
Points: 686, Level: 9 Points: 686, Level: 9 Points: 686, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2005
Location: Kolkata, West Bengal, India.
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think runat=server may not be required as I am testing in my local machine and the whole project is running in wwwroot.
Reply With Quote
  #5 (permalink)  
Old December 3rd, 2005, 11:43 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

A. What do you mean when you say "single line of code inheriting the home.html"? You can't "inherit" from an HTML file.

B. It looks to me like you need to review what the "runat" attribute does. This has nothing to do with where the application is running. It has to do with how the ASP.NET engine interprets the tags in your ASPX file. Specifying runat="server" tells ASP.NET to create an instance of the control declared in the tag on the dynamically generated class that is used to process and render an ASPX page.

-Peter
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
class Not found exception Poman Prashant Java Databases 2 June 7th, 2007 03:26 AM
The page cannot be found tbroom BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 13 August 18th, 2006 10:32 AM
HTTPListener Exception and 404 Not Found error JanK .NET Web Services 0 June 2nd, 2006 03:56 AM
" Error" Page not found shoakat Classic ASP Databases 1 November 15th, 2004 03:59 AM
Page Not Found Error ztz02 Classic ASP Basics 2 June 25th, 2003 08:52 AM



All times are GMT -4. The time now is 03:05 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.