Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
715
Access UltraWebgrid within WebMethod
posted
Hi All, In my application i'm using cellchange handler and pass the cell index to the WebMethod(static method and its return type is string), but it doesn't return anything. my problem is i want to manipulate some process using the passed index and assign the return values to other grid cells. //sample code function CellChange(gridName,cellId) { var oCell = igtbl_getCellById(cellId); var getValue = PageMethods.GetCellID(oCell.Column.Index); // here i will assign this value to some other cells. but i can't get the value from variable getvalue } // My code in the server side. [System.Web.Services.WebMethod] public static string GetCellID(string rowId) { string getID = rowId; // Here i will do some manipulation. return getID; } and also i want to know, can i access webgrid within static webmethod, is their any technique. Please reply me. Thanks in Advance, Regards, Vasanth.
Parents
No Data
Reply
  • 28464
    posted

    Hello Vasanth,

    Thanks for writing - this is an interesting topic. The problem with WebServices (WebMethods) is that they are not part of the page lifecycle and do not have access to the page control tree. I in fact believe that this is a good thing and by design - since that idea of web-services is to just request/respond to specific needs with custom logic, and not to take the burden of the whole quite complex ASP.NET infrastructure.

    So I believe in your case you may need to change your code to just call an event handler / method on the page, so that the control tree will be available there and you will be able to get instnace of the grid. Calling server-side page methods from client-side javascript is also a tricky topic, but is doable. I can suggest the following article on information how it can be done:

    http://www.dotnetcurry.com/ShowArticle.aspx?ID=109&AspxAutoDetectCookieSupport=1

    The idea is to call a method in the same page where the grid is located and the method will be able to access the controls page Tree, including grids inside. 

Children
No Data