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.
Are you saying you cannot access the grid from "within" the control or from the page that the control is on?
Hi Chris, Thanks for responding. Sorry for the confusion. When I use a WebGrid normally (not in a user or custom control) I can use the grid without problems. I can access properties and events and everything is fine.
When I put my user grid (ascx) onto a web form (default.aspx), I can't access any properties or events for the user grid (ascx), unless the code is in the ascx file itself. But I don't want that. The grid columns will be different depending what button the user clicked. I would like to have all the code for using my user grid in default.aspx but It won't execute any events and I can't set any properties. I placed a breakpoint inside the InitializeLayout event but it dosen't even fire.
UPDATE: Ok I've tried to expose some simple properties, like width and height but the code is still being ignored. This is inside the ascx code-behind file.
Code Example:
Public Property Width() as Unit
Get
return WebGrid.Width
End Get
Set(ByVal value As System.Web.UI.WebControls.Unit)
WebGrid.Width = value
End Set
End Property
Also, how does one expose deeper properties such as DisplayLayout.AutoGenerateColumns or Layout.Bands(0).Columns.FromKey("").Hidden?
Also, how would I expose events for my grid?
I hope I have been clear enough.
Thanks for your help Chris!!