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:
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();
}