 |
|
 |
Hi guys,
I'm binding my radgrid with a simple array country list and the edit option in each:
protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
ArrayList list = new ArrayList();
list.Add("country1");
list.Add("country2");
list.Add("country3");
RadGrid1.DataSource = list;
}
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" EditText="Modify" CancelText="Back" >
<HeaderStyle Width="10px" />
<ItemStyle CssClass="MyImageButton" Width="10px"/>
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn HeaderText="Country" ReadOnly="True" Visible="true" >
<HeaderStyle Width="60px"/>
<ItemStyle Width="60px" />
</telerik:GridBoundColumn>
</Columns>
but I don't know how to retrieve the info selected with the edit command
If I had a keyvalue I could do this:
GridEditableItem editedItem = (GridEditableItem)e.Item;
string country = editedItem.GetDataKeyValue("country").ToString();
but this is not my case,as my radgrid doesn't have any index or keyvalue
How can I solve this?
Thanks a lot for your help!!
|
|
|
|
 |
|
 |
Hey,
Thanks for this article i needed to use it for compact framework and it really works, so definetelly i can make custom implementation of my entity objects without use of properties. All in a dinamic way.
|
|
|
|
 |
|
 |
Can this method be used on VERY large arrays (for example, with 1.000.000 rows)? Will binding be done dynamically?
|
|
|
|
 |
|
 |
Yes, it will work, but performace you can test yourself.
http://www.mommosoft.com
|
|
|
|
 |
|
 |
What is the license on this code? Can it be used in a commercial project?
- Henrik
|
|
|
|
 |
|
 |
You are free to use it, also changed if you need.
Regards
Michail
http://www.mommosoft.com
|
|
|
|
 |
|
 |
Thank you for your quick reply! Just to clarify, no payment is required to use or modify this software within a commercial project?
- Henrik
|
|
|
|
 |
|
 |
No payments.
Regards
Michail
http://www.mommosoft.com
|
|
|
|
 |
|
 |
Hello Mihail,
Let me first tell you that you have created a great object in 'ArrayDataView'.
How can I have this object support LINQ and filtering/sorting and grouping?
If this is possible, then this object can be used by thousands of developers all over the world.
Thanks
Sunil
sun21170
|
|
|
|
 |
|
 |
Give me some sniped how you want to use it in LINQ situation, and I can think of some implementation. Currently is not supported.
http://www.mommosoft.com
|
|
|
|
 |
|
 |
Hello Mihail,
I appreciate your reply.
I am wanting to use a table type data structure that will be cached in an ASP.Net application and would contain upto 10,000 rows. I think the DataTable is not an option, and your dll is excellent for this type of requirement.
I am going to bind this to Telerik's RadGrid (Q3 2008 ASP.NET AJAX RadControls). I was able to bind your object to this grid, but I had to set 'EnableLINQExpression' to false. With 10,000 rows in your data object, LINQ would help greatly when binding to RadGrid so I could use 'custom paging' (rather than standard paging).
You can download the trial ASP.NET AJAX controls from http://www.telerik.com/products/aspnet-ajax.aspx[^]
Thanks
Sunil
sun21170
|
|
|
|
 |
|
 |
To use your object with RAdGrid of Q3 2008 ASP.NEt AJAX, I had to include the following code in code-behind:
protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
const int dim = 2;
string[,] array = new string[dim, dim];
array[0, 0] = "Product1";
array[0, 1] = "Company1";
array[1, 0] = "Product2";
array[1, 1] = "Company2";
string[] colnames = new string[dim];
colnames[0] = "Product";
colnames[1] = "Vendor";
Mommo.Data.ArrayRowView arow = new Mommo.Data.ArrayRowView();
RadGrid1.DataSource = new Mommo.Data.ArrayDataView(array, colnames);
}
sun21170
|
|
|
|
 |
|
 |
I think to be able to use LINQ expressions, your data object should be able to be used as a 'LinqDataSource' in ASP.Net 3.5. I don't know how this would be possible using your data object.
Thanks
Sunil
sun21170
|
|
|
|
 |
|
 |
I will put some thinking and will answer your shortly.
http://www.mommosoft.com
|
|
|
|
 |
|
 |
20% of the time I receive this error message: DataGrid with id 'Datagrid2' could not automatically generate any columns from the selected data source. -sheila
|
|
|
|
 |
|
 |
send me example which do does not work for you
http://www.mommosoft.com
|
|
|
|
 |
|
 |
'Session("Ar3_non_site") is a 2-dim array
Datagrid2.DataSource = New Mommo.Data.ArrayDataView(Session("AR3_non_site"))
Datagrid2.DataBind()
|
|
|
|
 |
|
 |
Probably some time this session variable is null, Do you test it for null ?
http://www.mommosoft.com
|
|
|
|
 |
|
 |
Yes, I check to see the length right before.
|
|
|
|
 |
|
 |
What else can I look at? These lines of code were working yesterday, today I can't get them to work at all. Datagrid2.DataSource = New Mommo.Data.ArrayDataView(Session("AR3_non_site")) Datagrid2.DataBind() -smc
|
|
|
|
 |
|
 |
check Session("AR3_non_site") != null and if is array
http://www.mommosoft.com
|
|
|
|
 |
|
 |
OK,
How do I check for object type in VB.net.
I'm using this to get the length of the array, it is = 3484
temp2 = Session("AR3_non_site").length
-smc
-- modified at 16:09 Wednesday 1st August, 2007
|
|
|
|
 |
|
|
 |
|
 |
Thanks, that link helped.
Yes, Session("AR3_non_site") is typed as an Array, and it is not empty.
-smc
|
|
|
|
 |
|
 |
It is binding now. On the previous page one of the arrays was defined as an object array. I changed it to a string array, and now the array to datagrid bind is working.
Thanks for all your trouble today.
-smc
|
|
|
|
 |