0

我正在编写一个与 SQL 数据库交互的 SharePoint Web 部件,允许用户使用一些下拉列表设置一些参数并为给定客户提取记录。

我希望在选择客户后显示三个特定的 HTML 表格之一。我感到困惑的是如何在页面已经运行 RenderContents 之后呈现 HTML。最初,我只需要显示 ddls 和一个按钮,以便用户可以进行选择,所以我将它们放在 RenderContents 方法中。一旦他们单击按钮,我想显示包含数据的三个表之一,这将由他们设置的参数确定。我不确定如何开始编写这样的方法,尽管我确信它会涉及 HtmlTextWriter。这是代表我需要的伪代码:

protected override void RenderContents(System.Web.UI.HtmlTextWriter output)
{
    ... displays dropdownlists and button ...
   renderMachineSpecifications();
}

void renderMachineSpecifications()
{
   if (record returned according to ddls is in the range 1000-1999)
   {
        // Render table type A and fill with information from database
   }
   else if (record returned according to ddls is in the range 2000-2999)
   {
        // Render table type B and fill with information from database
   }
   else
   {
        // Output error message
   }
}

非常感谢!

4

1 回答 1

1

恐怕这是一个让 AJAX 尖叫的问题。这是SharePoint (MSDN) 中的 ASP.NET AJAX的链接。如果你用谷歌搜索,你可能还会在 CodePlex 上找到类似这个的其他一些掘金。

于 2009-12-14T21:04:32.907 回答