Click here to Skip to main content
15,915,019 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
JavaScript
$(function () {               
                $.ajax({
                    type: "POST",
                    url: "ListOfAvailableProjectforEngineer.aspx/GetAvailable",
                    data: "{userid:'<%=Session["userid"].ToString()%>'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: OnSuccess,
                    failure: function (response) {
                        alert(response.d);
                    },
                    error: function (response) {
                        alert(response.d);
                    }
                });
            });      
        function OnSuccess(response) {
            var xmlDoc = $.parseXML(response.d);
            var xml = $(xmlDoc);          
            var customers = xml.find("Table");
            i = 1;
            var row = $("[id*=gvViewProject] tr:last-child").clone(true);
            $("[id*=gvViewProject] tr").not($("[id*=gvViewProject] tr:first-child")).remove();
            $.each(customers, function () {
                var customer = $(this);               
                $("td", row).eq(0).html(i++);
                $("td", row).eq(1).html($(this).find("projectId").text());
                $("td", row).eq(2).html($(this).find("ProjectTitle").text());
                $("td", row).eq(3).html($(this).find("ExpectedDays").text());
                $("td", row).eq(4).html($(this).find("CustomerTypeName").text());
                $("td", row).eq(5).html($(this).find("CountryName").text());
                $("td", row).eq(6).html($(this).find("priority").text());
                $("[id*=gvViewProject]").append(row);
                row = $("[id*=gvViewProject] tr:last-child").clone(true);
                var autoId = $(this).find("projectId").text();
            });    }
    </script>

And using Webservice
C#
//----------------------------------------------------web Service for ListOf Availabel project  Gridview----------------------------------------------------//

    [System.Web.Services.WebMethod]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public static string GetAvailable(int userid)
    {
        DataSet ds = UserClass.LoadEngineerWithProject(userid);
        return ds.GetXml();
    }

but I have a problem when we navigate through next page then project id is not pass to other page .
please give me Suggestion .thanks in advance.
Posted
v2
Comments
At which line you are navigating ?
Manish Pandey 8-May-13 1:23am    

<itemtemplate>
<a href="AvailableForEngineer.aspx?projectId="></a>
</itemtemplate>

gridview item template a href="AvailableForEngineer.aspx?projectId="Eval(projectod)"what we use in in place of Eval
It should be like the anchor in this answer...
Anchor Link in DataGrid ItemTemplate
Manish Pandey 8-May-13 3:04am    
I am trying all the method of anchor but it not pass a value.
Prasad Khandekar 7-May-13 9:57am    
Hello Manish,

Your calling code only passes userid (data: "{userid:'<%=Session["userid"].ToString()%>'}",). So it's obvious.

Regards,

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