You must Sign In to post a response.
  • Category: JQuery

    Bind gridview through jquery/javascript

    I want to bind gridview throgh jquery/javascript .

    Reason is I am calling web api through jquery ajax calls, and want to show the results in gridview.

    here gvdata is gridview and objData is the (var objData = $.parseJSON(jsonData);)

    $("#gvData").append("<tr><td ><img src='data:image/jpeg;base64,{'" + objData.barrFile + "'}' alt='picture' border=3 height=100 width=100></img></td><td>" + objData.firstlName + "</td><td>" + objData.lastName + "</td><td>" + + "</td><td>" + + "</td><td>" + objData.isActive + "</td><td>" + objData.clubNumber + "</td></tr>");

    I am not able to show the image in 'td',if i hardcode the image url then it is working fine
    if i give src='data:image/jpeg;base64,{'" + objData.barrFile + "'} it is not working,i mean it is not parsing correctly.

    Can anybody suggests the answer?

  • #766310
    Json and Api Data where ever you bind check correct property name check them correct or not then

    step by step trace server side your json method how to data passing value etc then you can find the solution quickly.

    Name : Dotnet Developer-2015
    Email Id :

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #766329
    1. Try specifying correct Content-type, Content-encoding and charset like:
    src='data:image/jpeg;charset=utf-8;base64,"+ imagedata +"'
    2. Check your base64 data is correct or not over here '' or use:
    $imageData = base64_encode(file_get_contents($image));
    src='data:image/jpeg;charset=utf-8;base64,"+ $imageData +"'
    3. Try not to use {} after 'base64,', see an example jsfiddle over here:
    4. Find all the dedatils regarding 'Embedding Base64 Image Data into a Webpage':

  • #766334

    Yes I need to use charset.
    Thanks a lot ,Now its working fine .

  • Sign In to post your comments