TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
abdujalil chuliev
NA
400
41.6k
Convert c# HtmlTextWriter page into simple asp.net
Sep 5 2017 2:40 AM
Hi, I got an old web page which is written using HtmlTextWriter.
I have some problems to control it. So I wanted to convert that into simple asp.net page.
What is the way to do so? Below is my code:
<%@ Page Language=
"C#"
%>
<%@ Import Namespace=
"System.IO"
%>
<%@ Import Namespace=
"System.Data"
%>
<%@ Import Namespace=
"System.Data.SqlClient"
%>
<script language=
"C#"
runat=
"server"
>
protected
override
void
Render(HtmlTextWriter writer)
{
Response.Buffer =
true
;
Response.ContentEncoding = Encoding.UTF8;
String number_appl =
"20170001"
;
String objIntel =
"marks"
;
String username;
username = User.Identity.Name;
writer.WriteFullBeginTag(
"html"
);
writer.WriteLine();
writer.WriteBeginTag(
"meta"
);
writer.WriteAttribute(
"http-equiv"
,
"Content-Type"
);
writer.WriteAttribute(
"content"
,
"text/html; charset=utf-8"
);
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteLine();
writer.WriteBeginTag(
"xml"
);
writer.WriteAttribute(
"id"
,
"template"
);
writer.WriteAttribute(
"src"
,
"/edit/source.aspx?objIntel="
+ objIntel +
"&filename=template.xml&un="
);
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteEndTag(
"xml"
);
writer.WriteLine();
writer.WriteBeginTag(
"xml"
);
writer.WriteAttribute(
"id"
,
"data"
);
writer.WriteAttribute(
"src"
,
"/edit/source.aspx?objIntel=DataBase\\" + objIntel + "
&filename=\\xmls\\
" + number_appl + "
.xml&un=" + username);
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteEndTag(
"xml"
);
writer.WriteLine();
writer.WriteBeginTag(
"xml"
);
writer.WriteAttribute(
"id"
,
"style"
);
writer.WriteAttribute(
"src"
,
"/edit/source.aspx?objIntel="
+ objIntel +
"&filename=b7b.xsl&un="
+ username);
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteEndTag(
"xml"
);
writer.WriteLine();
writer.WriteBeginTag(
"xml"
);
writer.WriteAttribute(
"id"
,
"xmlerror"
);
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteBeginTag(
"XMLDATA"
);
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteEndTag(
"XMLDATA"
);
writer.WriteEndTag(
"xml"
);
writer.WriteLine();
writer.WriteBeginTag(
"LINK"
);
writer.WriteAttribute(
"REL"
,
"STYLESHEET"
);
writer.WriteAttribute(
"HREF"
,
"/edit/styles.css"
);
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteEndTag(
"LINK"
);
writer.WriteLine();
writer.WriteBeginTag(
"script"
);
writer.WriteAttribute(
"language"
,
"JScript"
);
writer.WriteAttribute(
"src"
,
"/edit/source.aspx?objIntel="
+ objIntel +
"&filename=showxml.js"
);
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteEndTag(
"script"
);
writer.WriteLine();
writer.WriteBeginTag(
"TITLE"
);
writer.Write(HtmlTextWriter.TagRightChar);
writer.Write(number_appl);
writer.WriteEndTag(
"TITLE"
);
writer.WriteLine();
writer.WriteBeginTag(
"body"
);
writer.WriteAttribute(
"alink"
,
"#006666"
);
writer.WriteAttribute(
"Link"
,
"#006666"
);
writer.WriteAttribute(
"Vlink"
,
"#006666"
);
writer.WriteAttribute(
"bgcolor"
,
"#f0fff0"
);
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteLine();
writer.WriteBeginTag(
"DIV"
);
writer.WriteAttribute(
"id"
,
"showResult"
);
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteEndTag(
"DIV"
);
writer.WriteLine();
writer.WriteBeginTag(
"FORM"
);
writer.WriteAttribute(
"ENCTYPE="
,
"multipart/form-data"
);
writer.WriteAttribute(
"action"
,
"savexml.aspx?un="
+ username);
writer.WriteAttribute(
"method"
,
"POST"
);
writer.WriteAttribute(
"name"
,
"FORM1"
);
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteBeginTag(
"INPUT"
);
writer.WriteAttribute(
"type"
,
"submit"
);
writer.WriteAttribute(
"name"
,
"Enter"
);
writer.WriteAttribute(
"value"
,
"????????????? ?????????"
);
writer.WriteAttribute(
"onClick"
,
"achSendDataToServer()"
);
writer.WriteEndTag(
"INPUT"
);
writer.WriteBeginTag(
"INPUT"
);
writer.WriteAttribute(
"type"
,
"hidden"
);
writer.WriteAttribute(
"name"
,
"blob"
);
writer.WriteAttribute(
"value"
,
"blob_xml"
);
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteEndTag(
"INPUT"
);
writer.WriteBeginTag(
"INPUT"
);
writer.WriteAttribute(
"type"
,
"hidden"
);
writer.WriteAttribute(
"name"
,
"appl_number"
);
writer.WriteAttribute(
"value"
, number_appl);
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteEndTag(
"INPUT"
);
writer.WriteBeginTag(
"INPUT"
);
writer.WriteAttribute(
"type"
,
"hidden"
);
writer.WriteAttribute(
"name"
,
"vid"
);
writer.WriteAttribute(
"value"
, objIntel);
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteEndTag(
"INPUT"
);
writer.WriteBeginTag(
"INPUT"
);
writer.WriteAttribute(
"type"
,
"hidden"
);
writer.WriteAttribute(
"name"
,
"un"
);
writer.WriteAttribute(
"value"
, username);
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteEndTag(
"INPUT"
);
writer.WriteEndTag(
"FORM"
);
writer.WriteLine();
writer.Write(
"<?xml version=\"1.0\" encoding=\"utf-8\"?> <user name=\"u_name\"> </user>"
);
writer.WriteEndTag(
"body"
);
writer.WriteLine();
writer.WriteEndTag(
"html"
);
}
</script>
Reply
Answers (
2
)
Error message on deployment to IIS 8,5
change paging color of Repeater on condition