在NewForm.aspx页面中设置值 [英] Set value in NewForm.aspx page

查看:48
本文介绍了在NewForm.aspx页面中设置值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


Hello Expert,



我需要在NewForm.aspx中设置SharePoint文本字段/多行区域值C#代码或Jquery。

实际上,在SP2013 / 2016中,所有SharePoint字段都不在浏览器的页面源中呈现。



我有自定义在文档库中上传文档的列,我需要在NewForm.aspx页面的其他SP多行列中设置它的URL。  
$


我正在做这是C#编程的全部内容。文档已上传到相关库中,并以C#代码上传了URL。 

但是当我通过调用JavaScript编程C#Code访问TextField / TextAera时,它无法正常工作。实际上所有Sp字段都不会在浏览器的视图页面源中呈现。



请建议您的观点。



谢谢,






Mukesh Ajmera |
LinkedIn |
http://mukeshajmera.wordpress.com/ |


如果这篇文章回答了你的问题,请点击"标记为答案"。在帖子上和"标记为有用"


解决方案


要将值设置为多行文本字段,请使用以下C#代码供您参考。

使用(SPSite site = new SPSite("http:// sp2013 / sites / team"))
{
using(SPWeb web = site.OpenWeb())
{

SPList list = web.Lists [" CL0311"];
SPListItem item = list.GetItemById(1);
item [" MultipleText"] ="< a href ='http://www.bing.com'> bing< / a>" ;;
item.Update();
}
}

以下jQuery代码供您参考。

< ; script src =" https://code.jquery.com/jquery-1.12.4.min.js"类型= QUOT;文本/ JavaScript的">< /脚本> 
< script type =" text / javascript">


(document).ready(function(){
var columnName =" MultipleText" ;;

(" DIV [ID ^ = '" + COLUMNNAME + QUOT;'] [ID

Hello Expert,

I need to set SharePoint Text field/Multi-line Area Value in NewForm.aspx either C# code or Jquery.
Actually, All SharePoint field not render in page source in browser in SP2013/2016.

I have custom column which upload document in document library and I need to set it's URL in other SP multi-line column in NewForm.aspx page.  

I am doing this all stuff in C# programming. Document uploaded in related library and get uploaded URL in C# code. 
But while I am access TextField/TextAera in programming C# Code with calling JavaScript then it's not working. Actually all Sp fields are not render in view page source in browser.

Please suggest your view.

Thanks,


Mukesh Ajmera| LinkedIn | http://mukeshajmera.wordpress.com/|

If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

解决方案

Hi,

To set value to multiple line of text field, the following C# code for your reference.

using(SPSite site = new SPSite("http://sp2013/sites/team"))
{ 
	using (SPWeb web = site.OpenWeb()) 
	{ 

		SPList list = web.Lists["CL0311"]; 
		SPListItem item= list.GetItemById(1);                     
		item["MultipleText"] = "<a href='http://www.bing.com'>bing</a>";
		item.Update();
	}
}

And the following jQuery code for your reference.

<script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script>
<script type="text/javascript">


(document).ready(function() { var columnName="MultipleText";


("div[id^='"+columnName+"'][id


这篇关于在NewForm.aspx页面中设置值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆