Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
340
comand name null and DeleteButton_Click not get fired
posted

i am trying to take help from below code
i have 2 problems
1) although i have given command name of my delete  button (" delete ") in properties ( f4 )
but when i checked command name like this 
  if (e.InnerCommandEventArgs.CommandName == "delete")
{}
its not working  its null
2)  DeleteButton_Click event is  not being fired
althoug i have created event . its goes for post back but not fire click event
how to resolve these 2 issues
  1. protected void DeleteButton_Click(object sender, EventArgs e)
  2. {
  3.    var a = 5;
  4.    CellItem item = (sender as Control).Parent as CellItem;
  5.    UltraGridRow row = item.Cell.Row;
  6.    //delete row from datasource and rebind the grid...
  7. }
  8. protected void UltraWebGrid1_ItemCommand(object sender, UltraWebGridCommandEventArgs e)
  9. {
  10.     if (e.InnerCommandEventArgs.CommandName == "delete")
  11.     {
  12.         CellItem item = (e.CommandSource as Control).Parent as CellItem;
  13.         UltraGridRow row = item.Cell.Row;
  14.         //delete row from datasource and rebind the grid
  15.     }
  16. }

Parents
No Data
Reply
  • 49378
    posted

    Hi qasimidl,

    Can you share the markup for your templated column containing your delete button. This would allow me to investigate the matter in more detail. I would also need to know your exact product version in order to be able to provide more adequate feedback.

    For reference, here is the markup of the templated column with which I tested this scenario (version 11.2):

    Code Snippet
    1. <igtbl:TemplatedColumn Key="deleteColumn" >
    2.     <CellTemplate>
    3.         <asp:Button Text="text" runat="server" ID="DeleteButton" CommandName="delete"
    4.             onclick="Unnamed1_Click" />
    5.     
    6.     </CellTemplate>
    7.  
    8.     <Header>
    9.     <RowLayoutColumnInfo OriginX="2"></RowLayoutColumnInfo>
    10.     </Header>
    11.  
    12.     <Footer>
    13.     <RowLayoutColumnInfo OriginX="2"></RowLayoutColumnInfo>
    14.     </Footer>
    15.  
    16. </igtbl:TemplatedColumn>

    Feel free to contact me if you have any additional questions.

Children