开发者

ASP MVC 3 Telerikgrid sending Rowvesion(byte[]) to controller

开发者 https://www.devze.com 2023-04-09 16:07 出处:网络
I have a telerik MVC 3 grid, that contains checkbox column. if the user select multiple items and clicks a button, i need to send the id and byte[] timestamp(for concurrency) to the controller. user c

I have a telerik MVC 3 grid, that contains checkbox column. if the user select multiple items and clicks a button, i need to send the id and byte[] timestamp(for concurrency) to the controller. user can select any number of items, so i dont want to bring the full row information to the controller. Also, it's a postback on the click. Is there a way to post the list of Id and timestamp together to the controller on the button click. Thanks in advance. View code of the grid columns from my app

.Columns(columns =>
               {
                   columns.LoadSettings(Model.GridColumnSettings);
                   columns.Template(
                                       @<text>
                                            <input name="SelectedRecords" type="checkbox" value="@(item.Id))" title="Select"
                                                @if ((Model.SelectedRecords!开发者_JAVA技巧= null) && (Model.SelectedRecords.Contains(item.Id)))
                                                {

                                                            <text>checked="checked"</text> 
                                                }
                                            />                                                
                                       </text>                                                                               
                                   ).Title("Select").Width(23).HtmlAttributes(new { style = "text-align:center" });


Would this be with DataBinding? I only messed with Telerik briefly, but did have a grid running. I used ajax to call my control as such:

.DataBinding(dataBinding => dataBinding.Ajax()
            .Select("_Paging", "Home")
            .Update("_Paging", "Home")
            .Insert("Create", "Home"))

I'd suspect you could pass variables to the controller as you would in an action link (though I've not tried this...)

.Select("_Paging", "Home", new { timestamp = DateTime.Now }, null)


The simple answer for this is using Convert.FromBase64String and Convert.ToBase64String for sending and recieving byte[]. i found this from http://junmeng.blogspot.com/2006/05/optimistic-concurrency-control-using.html

thanks for the your time Eddie

0

精彩评论

暂无评论...
验证码 换一张
取 消