데이터베이스에 저장된 html 페이지를로드하라는 제안이 있습니까?ASP.NET 페이지의 데이터베이스에서 html 실행
HTML :
이<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>xxx</title>
</head>
<body>
<form id="Form1" runat="server" method="post">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
</form>
</body>
코드 숨김 :
protected override void OnInit(EventArgs e)
{
this.IniciarFormulario();
using (ServicoECMClient proxy = new ServicoECMClient())
{
tipoDocumento = proxy.ObterTipoDocumento(int.Parse(tipoDocumentoID));
}
if (tipoDocumento == null)
{
throw new ApplicationException();
}
this.Page.Header.InnerHtml = tipoDocumento.estilo; //css
this.Page.Form.InnerHtml = tipoDocumento.form; // form
base.OnInit(e);
}
내가 양식 값을 검색 할 수 없습니다.
봐 :
foreach (System.Web.UI.Control controle in this.Form1.Controls)
{
if (controle.GetType().Name == "HtmlInputText" || controle.GetType().Name == "HtmlInputSelect"
|| controle.GetType().Name == "HtmlInputRadio" || controle.GetType().Name == "HtmlInputTextCheckbox")
{
if (!string.IsNullOrEmpty(this.Request[controle.ClientID]))
{
documento_indice documentoIndice = new documento_indice();
documentoIndice.id_indice = int.Parse(controle.ClientID.Split('_')[1]);
documentoIndice.valor = this.Request[controle.ClientID];
documentoIndice.timestamp = DateTime.Now;
documentos_indices.Add(documentoIndice);
}
}
}
제어가 비어 있습니다. => this.Form1.Controls
제안 사항이 있으십니까?
더 좋은 방법이 있습니까?
감사합니다.
Request.Form["txtSomething"]
당신이 얻을 수 있다는 것을 의미합니다 : 당신이 당신의 양식을 읽을 필요 해요 손으로 컨트롤 모음 (까다로운 사업)에 컨트롤을 추가하지 않는 한
그건 html 페이지입니다.시작 부분에 Aspx 마크 업이 없으므로 코드 배후에서 파생되었음을 나타내며 페이지가 컴파일되었음을 나타내지는 않습니다. 따라서 코드 뒤에서 결코 나타나지 않을 것입니다. HTML이 완성 되었습니까? –
데이터베이스에서 원시 html을 렌더링하려는 경우 핸들러 (ashx) 파일과 Response.Write()를 사용하여 HTML을 출력합니다. –
VirtualPathProvider 살펴보기 http://msdn.microsoft.com/en-us/library/system.web.hosting.virtualpathprovider.aspx –