Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 25th, 2010, 02:15 AM
Authorized User
Join Date: Apr 2010
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default gridviewbind using javascript or webmethod

hi every one,

I am using modelpopupextender.this will be shown on keypress event (F2 press) using javascript. This modelpopup,targeted to panel,having a gridview where i bind data during the form view databound event.But the problem is i need to rebind the gridview when F2 is pressed,untill formview mode is not changed.This rebind is to be done bcoz, when a new record is entered in masters,it is not been shown in the gridview as post back is not happening. So i want to try it by web method. But in static webmethod,it is unable to find the gridview control. So,can anyone suggest,or send the related code to solve the problem. I hope u understood the problem.

[WebMethod(EnableSession = true)]
public static int fun()
//here i am unable to find the control

is this the right method to do?

Old May 25th, 2010, 03:09 AM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

Why are you posting the same message multiple times? Doesn't make it any easier.

That said, this is by design.

WebMethod(EnableSession = true)]
public static int fun()
  //here i am unable to find the control
Web methods are static and thus apply to the class, rather than to an instance of a class. As such you can't access controls.

Try an UpdatePanel or an AJAX call that results JSon.


Imar Spaanjaars
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!

Similar Threads
Thread Thread Starter Forum Replies Last Post
static function with webmethod ahmedzakey1983 ASP.NET 3.5 Professionals 0 February 18th, 2010 07:36 AM
No Render Webmethod in ReportingService webservice recook2 Reporting Services 0 April 12th, 2007 03:38 PM
Return datatable from a webmethod josemanjusha ASP.NET 2.0 Basics 0 September 21st, 2006 07:52 AM
Webmethod error while return type is a dataset Hagop General .NET 1 August 10th, 2005 05:46 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.