如果webform引用masterpagefile,则Edititemtemplate数据显示为空白 [英] Edititemtemplate data appears blank if webform references a masterpagefile
问题描述
我有一个DetailsView和一个SqlDataSource到SQL Server。如果我有
I have a DetailsView and a SqlDataSource to SQL Server. If I have
MasterPageFile="~/Site.Master"
;然后在编辑模式下,文本框(在EditItemTemplate中)都显示为空白,但您可以单击文本框并退格并删除每个字母。所以奇怪的是文字是白色的白色。当页面引用主页面时,该页面还具有< asp:content>标签代替html,head,body和form标签。
但是,如果我顶部没有MasterPageFile引用,那么DetailsView运行完美,显示应该在编辑模式下的数据。在这种情况下,我使用html,head,body和form标签。
我想使用MasterPageFile引用,所以我可以使用默认的Navbar。
问题: 有没有办法让MasterPageFile引用不破坏EditItemTemplate功能?
我尝试过:
EditItemTemplate出现空白line:
<%@ Page Title =AboutLanguage =C#MasterPageFile =〜/ Site.MasterAutoEventWireup =trueCodeBehind =MyInfo1.aspx。 csInherits =UserInfo.MyInfo1%>
EditItemTemplate可正常使用此行:
<%@ Page Language =C#AutoEventWireup =trueCodeBehind =MyInfo2.aspx.csInherits =UserInfo.MyInfo2%>
at the top of the aspx page; then when in Edit mode, the textboxes (in EditItemTemplate) all appear as blank, although you can click into a textbox and backspace and remove each letter. So it's strangely like the text is white against white. As the page references a Master page, the page also has <asp:content> tags instead of html, head, body, and form tags.
However, if I do not have the MasterPageFile reference at the top, then the DetailsView operates perfectly, displaying the data while in edit mode as it should. In this case, I use html, head, body, and form tags.
I would like to use the MasterPageFile reference so I can make use of the default Navbar.
Question: Is there a way to get the MasterPageFile reference to not break the EditItemTemplate functionality?
What I have tried:
EditItemTemplate appears Blank with this line:
<%@ Page Title="About" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="MyInfo1.aspx.cs" Inherits="UserInfo.MyInfo1" %>
EditItemTemplate works correctly with this line:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MyInfo2.aspx.cs" Inherits="UserInfo.MyInfo2" %>
推荐答案
剪下你的母版页直到它工作;或者,做一个额外的并从头开始直到你失败,一次从老大师那里添加一块大块。
假设你有一个大师在某些时候起作用的页面。
Cut your master page down until it works; or, make an "extra" and start from scratch until you fail, adding chunks from the "old" master a chunk at a time.
Assuming you had a master page that worked at some point.
这篇关于如果webform引用masterpagefile,则Edititemtemplate数据显示为空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!