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

[Solved] On edit click control directing to rowclick event.

3 Answers 133 Views
Grid
This is a migrated thread and some comments may be shown as answers.
nagarjun
Top achievements
Rank 1
nagarjun asked on 01 Apr 2009, 10:32 AM
Hi,

   I have two RadGrids. Grid1 is populated with fields and has edit column. On row click of Grid1 i have to populate fileds for Grid2. Everything is going fine. But the problem is on edit (command column) column click control was not directed to edit form but it was directed to rowclick event.
 
  When i click on edit it should be directed to edit form and when i click on other columns Grid2 should populate. Any one give me an idea please.

On row click i am writing this event :
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == "RowClick" && e.Item is GridDataItem && i == 1)
            {
                GridEditableItem editedItem = e.Item as GridEditableItem;
                int workFlowStepId = Convert.ToInt32(editedItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["WorkFlowStepId"]);

                RadGrid2.Visible = true;
                RadGrid2.DataSource = WorkFlowProxy.GetWorkFlowStepDeliverables(workFlowStepId);
                RadGrid2.DataBind();
            }
        }


Thanks
Nagarjun S.

3 Answers, 1 is accepted

Sort by
0
nagarjun
Top achievements
Rank 1
answered on 01 Apr 2009, 01:22 PM
And here the main problem is if i remove "<ClientSettings EnablePostBackOnRowClick="true"></ClientSettings>" this from .ascx page i am able to get edit form perfectly. But when i add this and press edit the form is not opening.


Thanks,
Nagarjun S.
0
Princy
Top achievements
Rank 2
answered on 02 Apr 2009, 07:33 AM
Hi Nagarjun,

Could you please take a look at this forum discussion. You might be able to get some idea to sort out your issue:
EnablePostBackOEnablePostBackOnRowClick="true" & other button on grid

Thanks
Princy.
0
nagarjun
Top achievements
Rank 1
answered on 02 Apr 2009, 10:25 AM
Hi,

    I have gone through the link and did't find more important to my task. And one thing i found important is .. "e.Item.FireCommandEvent("Edit", e);".

    Actually my grid should perform 2 tasks. First one is on "EditCommandClick"(edit, which is one of the column of grid) a form shd open and where i can edit column fields. Second is on row click i have to populate other grid say "grid2".

   Now the problem is when i click "edit" or row the task performing is 2nd task, which shd not happen. I have tried putting "e.Item.FireCommandEvent("Edit", e);" in ItemCommand event as follows:

1) protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {

        }
2)protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == "RowClick" && e.Item is GridDataItem)
          
                    e.Item.FireCommandEvent("Edit", e);
                   
   GridEditableItem editedItem = e.Item as GridEditableItem;
                    int workFlowStepId = Convert.ToInt32(editedItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["WorkFlowStepId"]);

                    RadGrid2.Visible = true;
                    RadGrid2.DataSource = WorkFlowProxy.GetWorkFlowStepDeliverables(workFlowStepId);
                    RadGrid2.DataBind();
            }

    When i execute in this way on rowclick or on edit click, both 1st and 2nd tasks were perform at same time.

   On execution of the program wht i have observed is: on row click control was directing to 2nd function and task was well, which is obvious. On editclick first control was hitting 1st function and getting all data from .ascx page and after getting all data to display in editform then control was hitting function num 2. So, i think because of hitting 2nd function last the 2nd task was performing and not 1st task.
 
   Can any one please find a way to it.

Thanks
Nagarjun S.
Tags
Grid
Asked by
nagarjun
Top achievements
Rank 1
Answers by
nagarjun
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or