Click here to Skip to main content
15,892,072 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI,
How to bind datalist in client side.Am using webservice in the server side,the return values is dataset with GetXml().And I get that values in client side using RESPONSE.I get the value but the values cannot be bind in the datalist.


Thanks in Advance.

What I have tried:

I tried the below Code:
C#
function succes(response) {
        var xmlDoc = $.parseXML(response.d);
        var xml = $(xmlDoc);
        debugger;
        var customers = xml.find("Table");
        var row = $("[id*=dlViewProd] tr:last-child").clone(true);
        $("[id*=dlViewProd] tr").not($("[id*=dlViewProd] tr:first-child")).remove();
        $.each(customers, function () {
            var customer = $(this);
            $("#img1", row).eq(0).html($(this).find("ProductImage").text());
            $("#lblPrice", row).eq(1).html($(this).find("ProductPrice").text());
            $("lnkId", row).eq(2).html($(this).find("ProductName").text());
            $("[id*=dlViewProd]").append(row);
            row = $("[id*=dlViewProd] tr:last-child").clone(false);
        });
    }

And Itz my server side Code:
  <pre lang="c#">
public static string range(string Price1, string Price2)
{
string cs = ConfigurationManager.ConnectionStrings["str"].ConnectionString;
using (SqlConnection con = new SqlConnection(cs))
{
string str = "select * from tblproddetails where ProductPrice between @1 and @2";
SqlCommand cmd = new SqlCommand(str, con);
cmd.Parameters.AddWithValue("@1", Price1);
cmd.Parameters.AddWithValue("@2", Price2);
SqlDataAdapter da = new SqlDataAdapter(cmd);
//DataTable ds = new DataTable();
DataSet dss = new DataSet();
da.Fill(dss,"tblProddetails");
con.Open();
con.Close();
return dss.GetXml();
}
Posted
Updated 23-Nov-16 0:11am
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900