I'm using UltraWebGrid on a web page. What I'm trying to do is, implement client-side paging. For this LoadOnDemand must be set to XML and InitializeDataSource event must be there. When I tried this in VB.NET it worked. But in C# I can't find InitializeDataSource event in property window. Writing this event in <igtbl:UltraWebGrid> tag in the ASPX file throws a compiler error.
Any thoughts? Quick response will be much appreciated.
Read my most recent post to my blog - Demystifying WebGrid Databinding
Short answer - the event is still there but it doesn't show up in intellisense. You can set the "OnInitializeDataSource" attribute in the grids ASPX to your handler, or manually add the event (grid.InitializeDataSource += ... ) in the OnInit page method.
-Tony
I could use an example that includes the ellipses (...). I don't need a complete hand-holding but a nice slap on the back would help. I keep getting slugged in the face, yuk, yuk...
just want to add something that might help you even more
In C# you will have to manually add the event handler using the following line. Do it while your page is initilizing.
UltraWebGrid1.InitializeDataSource += new InitializeDataSourceEventHandler(UltraWebGrid1_InitializeDataSource);
And yes... you can access the data on click of a button when grid has been binded.
Darrel, Buzurg...
I feel kinda guilty. I read your responses rather soon after they were submitted and didn't thank you. Very busy around here in Marine Land...
Regardless, the openning of this event has made life significantly easier. I am able to remove gobs of code and the use of the control makes far more sense.
Once again, thanks
The pleasure is all mines
hello,I did all the changes to my code according to your suggestions in previous posts, but still I am getting errorI set InitializeDataSource event in property window,also added event in page .aspx fileUltraWebGrid_InitializeDataSource(object sender ,Infragistics.WebUI.UltraWebGrid.UltraGridEventArgs e ) Is there any other slution for this problemThanksShital
What kind of error do you get? Could you elaborate you issue?
Yes , it is working now.
Thanks a lot
Shital
Convert event handler from private to protected
Ex.
private void PatientDataGrid_InitializeDataSource to
protected void PatientDataGrid_InitializeDataSource
Let me know if solves the issue.
I am just trying to load data from two tables.
This is my grid'd defination
<igtbl:UltraWebGrid ID="PatientDataGrid" runat="server" Height="300px" Width="100%" oninitializelayout="PatientDataGrid_InitializeLayout" oninitializedatasource="PatientDataGrid_InitializeDataSource" style="font-family: Arial; font-size: x-small" ondblclick="RowDbClick" Browser="Xml" EnableViewState="False" >
<DisplayLayout AllowColSizingDefault="Free" AllowColumnMovingDefault="OnServer" AllowDeleteDefault="Yes" AllowSortingDefault="OnClient" AllowUpdateDefault="Yes" BorderCollapseDefault="Separate" HeaderClickActionDefault="SortMulti" Name="UltraWebGrid1" RowHeightDefault="20px" RowSelectorsDefault="No" SelectTypeRowDefault="Single" StationaryMargins="Header" StationaryMarginsOutlookGroupBy="True" TableLayout="Fixed" Version="4.00" ViewType="Hierarchical" CellClickActionDefault="RowSelect" LoadOnDemand="Xml"> <ClientSideEvents AfterSelectChangeHandler="GridRowSel" ClickCellButtonHandler="PatientDataGrid_ClickCellButtonHandler" InitializeLayoutHandler="PatientDataGrid_InitializeLayoutHandler" AfterCellUpdateHandler="PatientDataGrid_AfterCellUpdateHandler" />
And on server side added this code
private void PatientDataGrid_InitializeDataSource(object sender, Infragistics.WebUI.UltraWebGrid.UltraGridEventArgs e) { this.PatientDataGrid.DataSource = NewGetData(); }
thanks
shital
Could it be possible for you to create a small sample and upload it here? It will help to identify the issue quickly.
Thanks for reply.
I am getting following error
Compiler Error Message: CS1061: 'ASP.patientbrowser_aspx' does not contain a definition for 'PatientDataGrid_InitializeDataSource' and no extension method 'PatientDataGrid_InitializeDataSource' accepting a first argument of type 'ASP.patientbrowser_aspx' could be found (are you missing a using directive or an assembly reference?)