Hi, I'm having trouble using properties and events when I put a WebGrid in a user control. I followed these instructions:
In some applications, there may be a situation where the
WebGrid displays data and multi-level data from your database on a Web Form. It also allows you to modify the data and update your database with the changes.
Toolbox Item: UltraWebGrid
Namespace: Infragistics.WebUI.UltraWebGrid
This project places a WebGrid on a User Control and this user control is placed on a Web Form. This methodology could be used to provide a list of items in a shopping cart as the user makes shopping cart item selections.
But I don't have access to the AutoGenerateColumns or the width and height properties. I also can't use the InitilizeLayout event. What am I missing? could you please help me out... with Visual Basic code would be greatly appreciated.
vs2005, Visual Basic, NetAdvantage 8.1.20081.1000
Thank you for your time.
Sorry, just saw it attached to the top of your post.
Can I get a copy of this sample?
Hi Devin,
Thanks for the reply. I'll try your sample.
Thanks again.
I will refer you to my previous suggstion of simply exposing the entire grid control as a property in the ASCX. Doing that,you could in your main ASPX page then simply say (C#, sorry..my VB is pretty rusty):
this.MyUserControl.Grid.InitializeDataSource += new InitializeDataSourceHandler(somemethod);
Since in my example, the "Grid" property exposed by the user control is simply returns the UltraWebGrid, you have access to the entire UltraWebGrid object model from the ASPX page. Otherwise your going to have to put a facade over every property, method and event that you want to expose from the Grid through the User Control, which would be a lot of work.
I have attached a sample WebSite that demonstrates what I am talking about.
Devin
Hello Chris and Devon. Thank you for your response. I've tried another approach to this, but i'm still having issues. Here's what i've done:
I still have an Infragistics webgrid in an ascx file. That's all that's on it. I don't have a datasource control, because all that gets done in code. I've exposed an event on the ascx page that looks like this:
Public Event InitializeLayout As Infragistics.WebUI.UltraWebGrid.InitializeLayoutEventHandler
With the above line of code, I should be able to use and catch this event when using the usercontrol on a regular aspx page, correct? However, the InitializeLayout event doesn't fire - even when I put a breakpoint in it. Is my code wrong? I don't understand why this doesn't work. Help apreciated.
Thank you.