在转发器控制器上生成sno [英] generate sno on repeater controll

查看:82
本文介绍了在转发器控制器上生成sno的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在加载时间上使用视觉网络部分的转发器控件,因为我绑定了转发器控件并添加

I am using repeater control on visual web part on load time as I bind repeater control and add

  ; <%#Container.ItemIndex + 1%> 

  <%#Container.ItemIndex+1 %> 

因此它会生成sno 完全像

so it generates sno  perfectly like

问题:

因为我使用Json(C#web api)添加或删除记录。下面是代码....和 

as I add or remove record using Json (C# web api) .below is the code.... and 

我在下面标记了"td" on" onsucessAdd"功能  使用此文字  " 这里需要显示S.no " ....我想要显示

I have marked below "td" on "onsucessAdd " function  with this text  "here need to show S.no".... where I want to show

sno ...

怎么做..as"   <%#Container.ItemIndex + 1%>"没有处理" onsucessAdd"功能

what to do ..as "  <%#Container.ItemIndex+1 %>" is not working on "onsucessAdd" function

如何添加 

how can I add 

  <%#Container.ItemIndex + 1%> ..

  <%#Container.ItemIndex+1 %> ..

   function InsertUserIntoManageHierarchy(){
   function InsertUserIntoManageHierarchy() {

推荐答案

你好qasimidl,

Hi qasimidl,

请检查响应对象,你可以使用控制台。 log(响应)检查所有属性,并且应该包含新添加的Item Id(S.no)。

Please check the response object, you could use console.log(response) to check all the properties, and the new added Item Id (S.no) should be included.

不确定Web API中的详细逻辑,但我测试了Rest API插入项,在响应中返回项ID,如下所示:

Not sure about detailed logic in your Web API, but I tested with Rest API insert item, the item Id is returned in the response like this:

<script type="text/javascript">
var item = {
        "__metadata": { "type": 'SP.Data.MyList3ListItem'},
        "Title": "value change111"
       
    };


.ajax({
url:_spPageContextInfo.webAbsoluteUrl +" / _ api / web / lists / GetByTitle('MyList3') / items",
类型:" POST",
header:{
" accept":" application / json; odata = verbose",
" X- RequestDigest":
.ajax({ url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('MyList3')/items", type: "POST", headers: { "accept": "application/json;odata=verbose", "X-RequestDigest":


(" #__ REQUESTDIGEST")。val(),
" content-Type":" application / json; odata = verbose"
},
数据:JSON.stringify(item),
/ *其中Title是列名,您可以通过拆分来添加更多列,* /
success:function(data){
console.log(data.d);
},
错误:函数(错误){
alert(JSON.stringify(error));
}
});
< / script>
("#__REQUESTDIGEST").val(), "content-Type": "application/json;odata=verbose" }, data: JSON.stringify(item), /*where Title is column name and you can add more columns by splitting with ,*/ success: function(data) { console.log(data.d); }, error: function(error) { alert(JSON.stringify(error)); } }); </script>





谢谢

最好的问候


这篇关于在转发器控制器上生成sno的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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