HI
i have a html page with a hyper link in an iframe. I want to fetch and display another html page from the DB using anchor link iD. Please help
SqlCommand cmd = new SqlCommand("select vcFilePath from tblBookNodes where iModuleId='" + svalue + "' ", conn);
conn.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
bytes = (byte[])dr["vcFilePath"];
}
conn.Close();
string fileName = svalue.Replace(" ", "_") + ".htm";
DirectoryInfo strPath = new DirectoryInfo(Server.MapPath("~/htmlFile/"));
string path = strPath + fileName;
var doc = new HtmlDocument();
string html = Encoding.UTF8.GetString(bytes);
doc.LoadHtml(html);
StringWriter sw = new StringWriter();
var hw = new HtmlTextWriter(sw);
StreamWriter sWriter = new StreamWriter(path);
sWriter.Write(sw.ToString());
doc.Save(sWriter);
sWriter.Close();
string fileContents = html;
System.IO.File.WriteAllText(path, fileContents);
// hfHTML.Value = fileContents;
Page page = (Page)HttpContext.Current.Handler;
MultiView control = ((IETM.Amm)(page)).MultiView1;
View View1 = (View)control.FindControl("View1");
HtmlControl ctrl = (HtmlControl)View1.FindControl("frmDisplay");
frmDisplay.Attributes.Add("src", HttpContext.Current.Request.Url + "/.." + "\\htmlFile\\" + fileName);
//hfHTML.Value = System.IO.File.ReadAllText(path);
MultiView1.SetActiveView(View1);
Above code is used to dispaly data from database using iframe.
<!--Arbortext, Inc., 1988-2018, v.4002-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>DMC-DO228-AAA-00-00-00-01A-000A-A.htm</title><meta
name="Generator" content="Arbortext Epic 7.1"><meta
http-equiv="Content-Type" content="text/html; charset=UTF-8"><style
type="text/css">
.p6 {padding-top: 6pt}
.b {font-weight: bold}
.p8 {padding-top: 8pt}
.l14al {line-height: 14pt; text-align: left}
.l1alp3 {line-height: 1pt; text-align: left; padding-top: 3pt}
.f14sb {font-size: 14pt; font-family: sans-serif; font-weight: bold}
.f16sb {font-size: 16pt; font-family: sans-serif; font-weight: bold}
.f18sbB {font-size: 18pt; font-family: sans-serif; font-weight: bold; color: blue}
.f11s {font-size: 11pt; font-family: sans-serif}</style><script
type="text/javascript" language="JavaScript">
<!--
var fltpopupht = 400;
var fltpopupwd = 480;
var fltwin;
function FltOnClick(hrefstr,popupnum) {
var winleft = (screen.width - fltpopupwd) / 2;
var wintop = (screen.height - fltpopupht) / 2;
winprops = 'height='+fltpopupht+',width='+fltpopupwd+',top='+wintop+',left='+winleft+',scrollbars=yes,resizable';
winprops += ',status=no,menubar=no';
popupname = "popup" + popupnum;
if (fltwin && fltwin.open) {
fltwin.close();
}
fltwin = window.open(hrefstr, popupname, winprops);
if (parseInt(navigator.appVersion) >= 4) {
fltwin.window.focus();
}
}
function CloseFltwin() {
if (fltwin && fltwin.open) {
fltwin.close();
}
}
// --></script></head><body style="line-height: 16pt"
onunload="CloseFltwin()"><div class="pgbrk" style="padding-top: 48pt"><div
style="line-height: 13pt; text-align: justify; text-indent: -40.7%; padding-left: 40.7%"><span
class="f14sb" style="font-size: 11pt"><a name="a1"></a>Data Module
Code: </span><span class="f11s" style="color: blue">DO228</span><span
class="f14sb" style="font-size: 11pt">-</span><span class="f11s"
style="color: blue">AAA</span><span class="f14sb"
style="font-size: 11pt">-</span></div>
</body></html>