Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8813985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:59:43+00:00 2026-06-14T03:59:43+00:00

I am working on a project where I succesfully made web servie calls via

  • 0

I am working on a project where I succesfully made web servie calls via ajax, returned the data, and binded single line results to text boxes. However, there are cases where a field such as account, might have multiple values, and indexed in my case. I am able to hard code the returned results and bind it, but i need to do it dynamically and not hard code it because the web service call could return different number of lines depending on the data given to it. Here is some of the code:

 function RetrieveEntity() {
 var pageUrl1 = "ajaxwebservicecalls.asmx/RetrieveEntity";
    $.ajax({
        type: "POST",
        url: pageUrl1,
        data: {},
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        async: false,
        success: OnretrieveSuccessCall,
        error: onretrieveFail
    });


}
function OnretrieveSuccessCall(msg) {
    var defaultdata = msg.d.Data;
    invoiceModel = defaultdata;
    var x = JSON.stringify(defaultdata);
    MyProject.viewModel = ko.mapping.fromJS(invoiceModel);
    ko.applyBindings(MyProject.viewModel)
alert("hello");
}

(No need to show the webservice asmx file because that part works fine)
the returned results look similar to this:

  header1.value = "abc"
  header2.value = "efg"

so when i bind it to a text box, all i have to do is call data-bind=”value: header1.value” and that works fine

However, multiple line results are returned in an indexed formart as follows:

Header1[(value1=xxx,value2=yyyy,value3=zzz),(value1=ddd,value2=fff,value3=fgghg)] 

so when i databind it (hardcoded value), i used

data-bind="value:header1()[0].value1" 

and that returns “xxx”

my problem is if i want to return all answers for value1 (xxx, ddd) and bind them on a grid. I used a template field grid, and placed a text box inside it, and tried to retrieve the value using a hardcoded index it worked. But when i wanted to return all possible values (using #index or $data0 it didn’t work. I’m not sure how to use it, and if it’s even possible to an ASP bind a gridview using knokcoutjs. please help me out. Below is the HTMl code (i will show one gridview field only, and i’m using the hardcoded index that is working).

 <asp:GridView ID="GridView2" runat="server"AllowPaging="True"AutoGenerateColumns="False">    
 <Columns>
 <asp:TemplateField HeaderText="Account" SortExpression="Account" >
  <ItemTemplate>
    <asp:TextBox ID="Account" runat="server" MaxLength="60" ReadOnly="true" 
     TabIndex="-1" Style="width: 250px" data-bind="value:APInvoiceItems()[0].Accountnumber"/>
                </ItemTemplate>
         </asp:TemplateField>
  </Columns>
    </asp:GridView>
<button onclick=" RetrieveEntity()"> Update </button>

the account number at index zero is returned from the above code. How to return index 1, 2 and so on?
All help is greatly appreciated. Thank you in advance!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:59:44+00:00Added an answer on June 14, 2026 at 3:59 am

    That’s not possible. GridVew is a server control so you can bind data to it only on server. Consider to use some JavaScript template engine like jsRender, doT, Underscore etc. to create layout from service response.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been working on a project which uses SPNEGO to have Single Sign On
I'm working on a project to integrate a custom made c# .DLL into powershell.
I am working on an .NET MVC 3 project where I have made all
Now I'm working on a web project. I need to create a XML document
I'm currently working on an Arduino project. At this point I got web page
I have a working project that Im amending, it crashes after trying to use
I'm curious if it is possible to move the written and fully working project
While working a project tonight, I ended up using one .js resource file for
I working on project and have problem with threading and update of UI. I
I m working on project user to move the image in one position to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.