I am trying to develop this feature in my grid view.
1. It uses SL 4 VS 2010 - WCF Ria services
2. It pulls data from a table and one of the fields is a foreign key of another look up table.
3. When I browsed through samples, I found out that we can write codeless RIA services. So all I want is to have a combobox with the lookup table values. The user should be able to select the combobox values inside the grid.
Can you please direct me how to achieve a combo box with ria service inside a grid and
FYI: since it has foreign key relationship, the corresponding fact table data has to be updated accordingly.
Thanks,
Rakesh
13 Answers, 1 is accepted
In order to achieve a code-less setting of the ItemsSource of the GridViewComboBoxColumn, you need to set it inside the Resource section and then use it as a StaticResource in the definition of the column.
For example:
<UserControl.Resources> <riaControls:DomainDataSource x:Key="customers"
Name="customerDomainDataSource" QueryName="GetOrdersQuery" AutoLoad="True" > <riaControls:DomainDataSource.DomainContext> <local:CustomersDomainContext /> </riaControls:DomainDataSource.DomainContext> </riaControls:DomainDataSource></UserControl.Resources><telerik:GridViewComboBoxColumn Header="ComboxColumn" DataMemberBinding="{Binding CustomerID}" SelectedValueMemberPath="{Binding CustomerID}" DisplayMemberPath="{Binding CompanyName}" ItemsSource="{Binding Data, Source={StaticResource customers}}" />I hope that helps. However, if you need any further assistance or a sample project for a reference, do not hesitate to get back to us.
Greetings,
Maya
the Telerik team
Thank you so much for the reply.
Now Combo box works great;
My combo box is inside the grid ;
How do I load the grid after the combo box loading of domain data source is done?
in code-behind; I had the workaround like
making the second datasource autoload as false
and after the data loaded event of first domain data source I explicitly write in code-behind to load second domain data source.
Is there a proper way of doing it instead of work-around?
Thanks for all the help,
Great work guys
Rakesh
Actually, the way is handle the asynchronous loading of the data is the recommended approach - set the AutoLoad Property to "False", load the data for the ComboBox in the code-behind and once it is done, set the ItemsSource Property of the grid. Furthermore, you can use the IsBusy Property of the grid, while loading and you can even implement a RadBusyIndicator.
Maya
the Telerik team
Thanks again.
Now I am trying to use the column footer or group footer ;
Group footer I mean its not going to be grouped by any parameter. It's going to be a whole grid footer,
Inside that I want to have a stackpanel template of
Aggregate count function in left
and rad data pager in right alignment.
How do I place these two controls inside the group footer?
I am using column footers now as shown in the picture but I dont want those line seperations and stuff.
Please direct me how I have to go.
Thanks
I am sending you a sample project illustrating how to get the result of an aggregate function of a column and put it inside a TextBox next to the RadDataPager.
Please take a look at it and let me know if it meets your requirements.
Maya
the Telerik team
I am sorry you got it wrong;
I need to have column count and rad data pager together inside the footer of my gridview.
To be precise I need my aggregation function and rad data pager in a stack panel and that stackpanel has to be placed inside the footer of my gridview.
If I use column footer, it will let me place the content in the same coulmn,.
If i want to use group footer, I have nothing to group.
So as we do like Grid.Rowspan = 3 , is it possible to do something like that in the footer of my gridview so that the panel extends over the 3 columns of my gridview?
Thanks for your help
Rakesh
If you want pager to be inside the grid you should modify RadGridView template using Blend and insert the pager at desired position. Otherwise you can just wrap the grid and the pager in a separate UserControl and reuse this control instead.
Greetings,Vlad
the Telerik team
Can you please show me a sample of how to place data pager inside the gridview?
Thanks
As I said you can modify the grid template using Blend and insert the pager at desired place.
Kind regards,Vlad
the Telerik team
I am trying to use the data validation in grid in cell validating event as displayed in this link
http://www.telerik.com/help/silverlight/gridview-managing-data-validation.html
Validation is ok. i.e. it shows a red cell but it doesnt pop-up the error message automatically. if you hover your mouse to the top-right corner, it displays the appropriate message,.
My question is as soon as a data is invalid, along with not only displaying the red box but also how to show the error message without needing the user to hover the mouse to the top-right corner?
Thanks
Rakesh
================================
Code Snippet
void dg_gridview_CellValidating(object sender, GridViewCellValidatingEventArgs e)
{
if (e.Cell.Column.UniqueName != "GroupName")
{
string _old_value = (string)e.OldValue;
string _new_value = (string)e.NewValue;
if (!String.IsNullOrEmpty(_new_value) && (_old_value != _new_value))
{
if (e.Cell.Column.UniqueName == "Code")
{
gActivityCode _editing_code = _domS_dms.gActivityCodes.Where(w => w.activityCode == _new_value.ToUpper()).FirstOrDefault();
if (_editing_code != null)
{
e.IsValid =
false;
e.ErrorMessage =
"Code already exists";
}
}
else
{
gActivityCode _editing_code = _domS_dms.gActivityCodes.Where(w => w.descrip == _new_value).FirstOrDefault();
if (_editing_code != null)
{
e.IsValid =
false;
e.ErrorMessage =
"Description already exists";
}
}
}
}
}
You may take a look at this forum thread, where you will find explanation as well as a sample project illustrating how to achieve the functionality you want.
Maya
the Telerik team
I have one querry,I am working with RadDatapager..
I want to integrate raddatapager with rad grid,Datapager to put in Radgrid header i am not aware how this will be working..
Any sugession how can i include raddatapager inside radgrid ,i want paging to be visible on radgrid header as well as on radgrid footer.
Thanks,
You may take a look at our online documentation for a reference how to implement the RadDataPager with the RadGridView. If you want to define it in any particular place inside the grid, you will need to predefine a bunch of templates, which is not an easy task and may lead to undesired and unexpected behavior. So, i would recommend you to either define it above or below the grid.
Maya
the Telerik team
