Hello,
I have entity framework classes, one is DownloadLink and i have these two columns to gird (not binded to any DownloadLink properties)
<telerik:GridViewColumn Header="New F.H.Id" UniqueName="NewFilehostId" Width="*"></telerik:GridViewColumn><telerik:GridViewColumn Header="New URL" UniqueName="NewUrl" Width="*"></telerik:GridViewColumn>
Only easy way to iterate row i found is using radGridViewReuploadStatus.Items, but that way i can't access those two added columns.
So i think easiest way would be to somehow extend DownloadLink and add these two new fields, i tried it like this
Other solution would be to get rows somehow like this
So what is ideal solution. Or how to nicely extend my DownloadLink class to include that two new required fields?
I have entity framework classes, one is DownloadLink and i have these two columns to gird (not binded to any DownloadLink properties)
<telerik:GridViewColumn Header="New F.H.Id" UniqueName="NewFilehostId" Width="*"></telerik:GridViewColumn><telerik:GridViewColumn Header="New URL" UniqueName="NewUrl" Width="*"></telerik:GridViewColumn>
Only easy way to iterate row i found is using radGridViewReuploadStatus.Items, but that way i can't access those two added columns.
So i think easiest way would be to somehow extend DownloadLink and add these two new fields, i tried it like this
class DownloadLinkExtended : DownloadLink {
public DownloadLinkExtended(DownloadLink origDl){
PropertyInfo[] myObjectProperties = origDl.GetType().GetProperties(); //BindingFlags.Public | BindingFlags.NonPublic
foreach (PropertyInfo pi in myObjectProperties)
{
object value = pi.GetValue(origDl, null);
if (value != null)
{
try
{
pi.SetValue(this, value, null);
}
catch (Exception) {
//selze to na komplexnim typu jako napr. PostData
}
}
}
}
public string NewUrl { get; set; }
public string NewIdOnFilehost { get; set; }
}
But well that reflection does not work and i don't have it set up like DownloadLinkExtended.DownloadLink because then every grid bound column would need to be DownloadLink.field and i don't want it that way. Also setting it in constructor for each property individually is to much error prone manual work.Other solution would be to get rows somehow like this
IList<GridViewRow> rows = radGridView.ChildrenOfType<GridViewRow>();But since there is no .Rows this it seams to me that it is not your recommended way.
So what is ideal solution. Or how to nicely extend my DownloadLink class to include that two new required fields?