【问题标题】:send data from list to sharepoint application page将数据从列表发送到共享点应用程序页面
【发布时间】:2012-06-20 17:42:08
【问题描述】:

有什么方法可以将 SharePoint 应用程序页面连接到 SharePoint 中的列表,以将表单内的数据(在应用程序页面中)保存到 SharePoint 中的列表中我需要知道它我可以在应用程序页面中创建连接代码以连接到列表,或者如果有其他方法可以做到这一点

这是我的代码

    <asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<input type="text" id="txta"/> <input type="text" id="txtb" /> 
<textarea id="txtarea" cols="10" rows="2">Text area</textarea> 
<input type="submit" /> </form>
 </asp:Content>
 <asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server"> Application Page </asp:Content>

当用户插入他的信息并单击提交发送到共享点列表的数据时,我需要编写代码来添加此表单中的信息

【问题讨论】:

    标签: asp.net sharepoint


    【解决方案1】:

    首先,我会将您的表单输入更新为服务器控件,以便您可以从代码隐藏文件中轻松引用它们。然后在您后面的代码中使用以下代码:

    using (SPSite oSiteCollection = new SPSite("http://Site_Name"))
    {
        using (SPWeb oWebsiteRoot = oSiteCollection.OpenWeb("/"))
        {
            SPList oList = oWebsiteRoot.Lists["Tasks"];
    
            SPListItem oListItem = oList.Items.Add();
            oListItem["Title"] = txtArea.Text;
            oListItem.Update();
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2011-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-09
      • 2015-06-28
      相关资源
      最近更新 更多