This is a migrated thread and some comments may be shown as answers.

OnCommand x

3 Answers 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Eduardo Chiletto
Top achievements
Rank 1
Eduardo Chiletto asked on 01 Mar 2010, 07:41 PM
I want to use de column of type "DownloadAttachment" and I create the folow code in de aspx file. But when I associate this code in de "OnCommand" (client) of radgrid my code in RadGrid1_ItemDataBound breaks.

            function gridCommand(sender, args) {
                if (args.get_commandName() == "DownloadAttachment") {
                    var manager = $find('<%= RadAjaxManager.GetCurrent(Page).ClientID %>');
                    manager.set_enableAJAX(false);

                    setTimeout(function() {
                        manager.set_enableAJAX(true);
                    }, 0);
                }
            }              

        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if ((e.Item.ItemType == Telerik.Web.UI.GridItemType.Item) || (e.Item.ItemType == Telerik.Web.UI.GridItemType.AlternatingItem))
            {
                PackCRM.Entities.Documento _doc = (PackCRM.Entities.Documento)e.Item.DataItem;

                if (_doc.DocumentoLido)
                    e.Item.Font.Bold = false;
                else e.Item.Font.Bold = true;


                string docID = _doc.ID.ToString();
                string param = "docid=" + _doc.ID.ToString() + "&ext=" + _doc.Tipo.ToLower().Trim();
                string url = "preview/checkfile.aspx?" + param;

                ImageButton btnView = (ImageButton)e.Item.FindControl("btnView");
                btnView.OnClientClick = String.Format("OpenDialog('" + url + "')");
            }
        }

Why its ocurrs?
Help?

3 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 02 Mar 2010, 08:56 AM
Hello Eduardo,

Could you provide more details on what exactly is breaking in the ItemDataBound event.

Thanks in advance.

Best wishes,
Tsvetoslav
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Eduardo Chiletto
Top achievements
Rank 1
answered on 02 Mar 2010, 11:20 AM
My problem is this:

I need to use de column of type "DownloadAttachment" in the RadGrid. I'm following this Example. But in my original project, I have some code on ItemDataBound of the same RadGrid.

When I associate the javascript function called gridCommand (according to the example) on the event "OnCommand" of my RadGrid and run the application, I have a break exception because the original type of the "DataItem" in the "DataBound"  is changed from "PackCRM.Entities.Documento" to System.Data.DataRowView.

I do not know what to do anymore.

Please, help?





0
Tsvetoslav
Telerik team
answered on 05 Mar 2010, 08:18 AM
Hi Eduardo,

Unfortunately, based on the information provided it is difficult to say what exactly the problem might be. Please, open up a formal support ticket and send a runnable test project that could be tested on our side.

Thanks ina advance.

Regards,
Tsvetoslav
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Eduardo Chiletto
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Eduardo Chiletto
Top achievements
Rank 1
Share this question
or