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

EditForm do not raise event Update command

2 Answers 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David Sánchez
Top achievements
Rank 1
David Sánchez asked on 17 Sep 2008, 01:34 PM
Hi
This is my scenario
Rad grid in a usercontrol, the grid uses a edit form type webuser control. when i click on the edit column the grid show the edit form with the data well binded. but when i click on a link button this one do not fire any event, and the grid do not raise the Updatecommand event, however the row of grid collapsed.
i looked the sample ( http://demos.telerik.com/ASPNET/prometheus/Grid/Examples/DataEditing/UserControlEditForm/DefaultVB.aspx) but do not show the code behinf the ascx to see the code of the button Update
thanks

2 Answers, 1 is accepted

Sort by
0
David Sánchez
Top achievements
Rank 1
answered on 17 Sep 2008, 05:14 PM
well , after a littele investigate  ,  i thik i can explain better my problem.
in order to update a row with a webusercontrol edit form, a i have a linkbutton in the editform tu update the row. well, the questions are:
- how i can update the row from the click event of the link button? to bind the controls i am using the ItemDataBound event the with code like this:

RadTextBox box = (RadTextBox)MyUserControl.FindControl("rtbUser");

box.Text = parentItem[

"DSUSERNAME"].Text;
it work fine

- Why the user control don't raise the click event of the link button? because i supose that i could raise the update proceess from there.

TA.

0
Princy
Top achievements
Rank 2
answered on 18 Sep 2008, 05:12 AM
Hello David,

Have you set CommandName property of the LinkButton? If not, try setting the CommandName property and then try accessing the UserControl in the ItemCommand event as shown below.
ascx:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %>  
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>  
  
<asp:LinkButton ID="LinkButton1"  CommandName="Update" Text="Update" runat="server"></asp:LinkButton> 

cs:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    { 
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode) 
        { 
            if (e.CommandName == "Update") 
            { 
                GridEditFormItem item = e.Item as GridEditFormItem; 
                UserControl user = item.FindControl(GridEditFormItem.EditFormUserControlID) as UserControl; 
                
            }         
        }         
    } 

Princy.
Tags
Grid
Asked by
David Sánchez
Top achievements
Rank 1
Answers by
David Sánchez
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or