I need to access the returned results of a LinqServerModeDataSource. When using the normal Linqdatasource you can access this information in the "Selected" event e.Result, but the devexpress object does not have this event.
Now that I think about it there are no "ed" events "Updated", "Inserted" only "ing" events on the devexpress data source.
Any help would be great
Thanks
Have you considered getting the data through the ASPxGridView once the data is returned?
Or you can use the Microsoft LinqDataSource with the ASPxGridView.
Related
I want to use the Aspx gridview with out connect it to datasource
From: Add new unbound row in bound AspxGridView
The ASPxGridView can't display unbound rows. As a possible solution,
create an intermediate in-memory datasource (e.g. DataTable), copy
rows from your read-only datasource into it, and bind it to the grid.
Then, you'll be able to programmatically add new rows to this
datasource.
You can manage in memory DataSet(other datasource types), to populate data in the grid. There are lots of DevExpress threads about such type of requirements. I suggest you to go through them and implement in the way that you like to prefer.
ASPxGridView - How to manipulate data without data source
aspxgridview without datasources
Add new unbound row in bound AspxGridView
I have a scenario where I want to put four identical Gridviews on the same page. (They will be on different tabs in an Ajax TabControl.) They show the same source data, but there are four corresponding groups of source data in a common underlying table. So I want to show Group 1 on Tab 1, Group 2 on Tab 2, etc. These Gridviews contain complicated controls, so I would prefer to use the same data source for all of them to avoid unnecessary repetition. The Insert and Update commands are completely identical.
So in theory I could build the Select command in such a way that I could filter the data based on the GridView that is binding to the SQLDataSource. The problem is that if I use the same SQLDataSource for all the Gridviews, I cannot find a way to have each GridView tell the SQLDataSource which one is calling it. I am thinking maybe this is not possible, because the SQLDataSource binds first before it knows what is binding to it, but I'm not sure. Can anyone think of a way to do this?
You can change the parameter value dynamically using OnSelecting event of SQLDataSource. This can be done in server side code.
Create a property which holds your current gridview unique key, which is causing SQLDataSource to fetch data from SQL database.
Assign this property unique gridview key on DataBinding event of gridview.
Based on this property change the parameter in OnSelecting event of SQLDataSource.
Let me know if I am missing something.
I have a GV and a DV that extract data from the same database. The link between these controls is when a record in the GV is selected, the DV displays more details about that record.
Do I need separate connections? Obviously, I haven't achieved this goal and am working on it. Thanks.
CLARIFICATION so as not to waste your time:
I am asking about connection, not datasource. The reason that I am not sure the same connection can be used is that with GV, the connection doesn't have any parameter. Whereas with the DV, it needs the record ID passed to it. Or am I wrong?
Here's the link to code on the net that makes me wonder:
http://asp.dotnetheaven.com/util/srcview.aspx?path=~/aspnet/samples/data/GridViewMasterDetails.src
I am a novice so am still confused with the terminology. Thanks for being patient.
They can use the same datasource. (Such as an ObjectDataSource or SQLDataSource)
You can use the same data source, i.e. a DataTable. But when the Gridview row is selected you will need to find the index of the selected row and then find the DataRow from the DataTable and rebind your DetailView to that DataRow. Hope this helps.
I think that you are using Visual Studio databinding, and I would say that same Connection(DataSource) object can be used (if that is the way it goes), but I would rather suggest you avoid this design time Visual Studio programming, although it is simple and fast
I'm looking for the easiest way to bind data from a SqlDataSource to textboxes dropped in Visual Studio 2008.
For example, I have 4 textboxes currently that have Address, City, State, Zip. I also have a SqlDataSource on the page fetching the ID of the record and selecting those 4 fields based on ID.
How am I able to quickly bind each box to those particular fields selected? I would think this would be really straight forward - but seems it's not. Seems like the answer is funneled towards having to create a GridView or some type of control.
Be gentle...I'm a nub :)
In general you are correct, if you want to use databinding you'll need to use an appropriate control. For this example I'd suggest using a FormView - it is designed to display the results from a single database record and uses templates, meaning you'll have complete control over the output. This article is probably a good place to start: FormView Control: Step by Step.
To read the values bound to the FormView in the code-behind class you would need to create an event handler for the FormView's DataBound event. In that event handler you would reference the controls programmatically via FindControl, like so:
Dim myLabel As Label = CType(FormViewID.FindControl("id"), Label)
Here, id would be the ID of the Label whose value you were interested in. Once you have a reference to the Label you can get its value using myLabel.Text.
does anyone uses this control and knows how to load data to it from simple datatable. There is not such a trick as DataSource...
Im assuming you just mean a datatable you have created programatically?
It will bind straight up like it would from a DataSource.
Just make sure your DataField name in the columns mark up matches the name of the column and your good to go, just as you would with a different datasource.
Then just do
grvFoo.DataSource = yourProgrammticallyCreatedTable;
grvFoo.DataBind();
But, since your doing this progrmatically I would recommend making a "BindTable" function. Eg a function that builds your datatable and bind. You can then use this for sorting / paging etc. As your doing this all programatically you must handle such events by hand, they are normally done with the SQL / Object Datasource etc.
you mean Telerik Radgrid ? If yes, you can also specify a "NeedDataSource" event in the aspx/ascx
http://www.telerik.com/help/aspnet-ajax/grdadvanceddatabinding.html
On a side note, just to let you know, we are having a lot of performance problems with Telerik. For the most part, you can use the inbuilt asp.net gridview (and do some more styling if needed) than taking a performance hit by using telerik (for their fancy grid)
We must use ItemsSource property like this:
dataGridView1.ItemsSource = LoadDataTable.DefaultView;
LoadDataTable - this is some DataTable, filled from SQL.