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

[Solved] User control edit form

4 Answers 165 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sadiya Lubna
Top achievements
Rank 1
Sadiya Lubna asked on 12 Jun 2008, 08:37 AM
Hi,

I am using a user control as edit form for RadGrid. How do I hook on to the click event of a button on the user control (the button is not Insert/Update/Cancel) while still keeping the grid in edit mode?

When I click the button, the grid goes out of edit mode. I want to pop up a dialogue box on click of the button while still keeping the edit form displayed. How do I achieve this?

Thanks,
Sadiya.

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 12 Jun 2008, 11:04 AM
Hi,

Try the following code snippet.

ASCX:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %> 
 
      <script type="text/javascript"
          function ClientClick() 
           { 
            alert('Do you wish to continue ?'); 
           } 
      </script> 
 
    <asp:Button ID="Button3" runat="server" Text="Button" OnClientClick="ClientClick" /> 
 


Thanks
Shinu.
0
Sadiya Lubna
Top achievements
Rank 1
answered on 12 Jun 2008, 10:45 PM
Hi,

Thanks. I want to show a dialogue box which is another user control. Irrespective of what I want to do, I want to know how to handle the click event of the button server side while still keeping the grid in edit mode.

Thanks,
Sadiya
0
Princy
Top achievements
Rank 2
answered on 13 Jun 2008, 05:02 AM
Hi Sadiya,

Try setting the CommandName for the button in the UserControl as shown below.

ASCX:
 
 <%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %>   
 
<asp:Button ID="Button1" runat="server" Text="PerformAction" CommandName="PerformAction" />   


CS:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)  
 {   
   if (e.CommandName == "PerformAction")  
     {   
 
   
     }   
}  


Thanks
Princy.
0
Sadiya Lubna
Top achievements
Rank 1
answered on 13 Jun 2008, 06:40 AM
Hi,

Thanks. The ItemCommand and buttons click event handlers were not getting fired due to some other AJAX issues in applications. Its all working fine now.

Thanks,
Sadiya.
Tags
Grid
Asked by
Sadiya Lubna
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Sadiya Lubna
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or