I am currently evalulating the UltraWebGrid for my company and I have run into a problem that should be easy (I hope). I have added the grid to my asp.net form and I want to reference it in javascript in order to handle the resize. I read several posts here on how to do this and specifically in the help it mentions to get a reference you do this:
var grid = igtbl_getGridById("UltraWebGrid1");
However, when I hit this line of code, I get the "Object expected" error. It seems as if the javascript containing this function is not getting imported somehow. However, it seems to work when I run the samples browser, so there must be something I am missing in my application.
Is there something in web.config or declarations section that I need that is not mentioned in the help or in the samples browser?
Thanks,
Tom
Is your WebGrid in a naming container, such as a content page used with a master page? If so, use the ClientID property of your WebGrid to determine what you should put as your parameter for the call to igtbl_getGridById().
I've seen syntax that you can put inline in your ASPX page to let ASP.NET determine this for you, but I haven't used it myself recently.
It's just on a plain-ole asp.net page. The problem isn't that it can't find the WebGrid, rather, that it doesn't know about the function igtbl_getGridById. I can F11 into the javascript for this function in the samples browser, but not in my own (I'm using VS2008 .net 3.5). So it's not even at the point yet where it's trying to find what I'm passing in.
I guess this set of javascript functions is rendered to the page whenever a grid control is added to the page. My guess is that something went wrong when you added your webgrid, so what I'd try is to delete/re-drag the control to see if it works. If your grid has already so customized, then drag&drop another grid just to see how it goes.
Please let us know what's on.
I also was thinking of trying on a new page and see what happens - and guess what it is working on the new page with only the grid on it (and some code-behind to populate it).
But ideally I'd like to get it working on my main page, but perhaps I won't be able to? The page I am trying to get it to work on is a very large page that has been migrated over the years from asp to asp.net. First I thought maybe I was missing the ig_common virtual directory, but it is there with all the files, then I thought perhaps I had to manually specify Javascriptfilename and javascriptfilenamecommon, but this did not make a difference either.
So what I have noticed on my page is this
var grid = igtbl_getGridById("SearchResultsGrid");
Fails with object expected and I can't hover over the igtbl
- 2nd time, my tab is being displayed and the grid is populated with data. This time it actually goes into the function but returns "undefined". I checked the ClientID and it is also "SearchResultsGrid".
So it seems as though I'm getting closer, but maybe the correct thing for me to do is to redirect hits on my tab to a new page with the grid in it, this would not be ideal but at least it would work.
You can either open the HTML source of the page and look for the <script src=> tags, or attach a debugger to the browser (firebug, iedevtoolbar in IE8) and see which scripts are currently loaded.
If the script tags are present, but the scripts are not present in the browser's memory that might give you an idea why.
WHat do you mean by referenced? How can I add this references? I thought that these references would be aded automatically.
Thanks, Alex
Are all of the javascript files referenced correctly? If igtbl_getGridById is unavailable, that usually means something went wrong with the JS files references.
Hello. I have the same problem: I get the object expected error in my Javascript method when calling this method - var theGrid = igtbl_getGridById("<%=ugCoverageHistory.ClientID %>");. My grid is on a content page included in a master page. Any ideas?
Alex
yep, you guessed it - it was on a panel that is hidden when the page first loads. I'm currently moving forward with implementing my grid on a new page, so far so good.
Thanks for the replies.