<asp:TableCell>
<asp:Localize ID="lblPlntnextOneCtrlRes" meta:resourcekey="lblPlntnextOneCtrlRes" runat="server" />
<asp:Button ID="cmdPlntAcceptnextOneCtrlRes" meta:resourcekey="cmdPlntAcceptnextOneCtrlRes" OnClick="cmdQualAccept_Click" runat="server" Text="Accept" Visible="True" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
我想獲得那種使用XmlDocument的輸出,但我不斷收到一個命名空間錯誤的asp:和元:如何使用xmldocument添加asp標籤?
目前,當我產生的標記,我結束了這一點(但會想使它看起來像上面的):
<TableCell>
<Localize ID="lblPlntnextOneCtrlRes" resourcekey="lblPlntnextOneCtrlRes" runat="server" />
<Button ID="cmdPlntAcceptnextOneCtrlRes" resourcekey="cmdPlntAcceptnextOneCtrlRes" OnClick="cmdQualAccept_Click" runat="server" Text="Accept" Visible="True" />
</TableCell>
</TableRow>
</Table>
下面是一些代碼,我使用創建標記:
Dim markupRoot As XmlElement = markup.DocumentElement
Dim rowElement As XmlElement = markup.CreateElement("TableRow")
Dim cellElement As XmlElement = markup.CreateElement("TableCell")
Dim contentElement As XmlElement = markup.CreateElement("Localize")
contentElement.SetAttribute("ID", "tag" & ctrlName & "DescRes")
contentElement.SetAttribute("resourcekey", "tag" & ctrlName & "DescRes")
contentElement.SetAttribute("runat", "server")
cellElement.AppendChild(contentElement)
rowElement.AppendChild(cellElement)
cellElement = markup.CreateElement("TableCell")
contentElement = markup.CreateElement("Localize")
contentElement.SetAttribute("ID", "tag" & ctrlName & "NoteRes")
contentElement.SetAttribute("resourcekey", "tag" & ctrlName & "NoteRes")
contentElement.SetAttribute("runat", "server")
cellElement.AppendChild(contentElement)
rowElement.AppendChild(cellElement)
不記得的語法,但你不只是需要添加'asp'命名空間?我認爲有創建元素的重載... –
我沒有找到任何添加命名空間。 – dotnetN00b