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

Default button trigger the delete button on grid

9 Answers 399 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Yoni
Top achievements
Rank 1
Yoni asked on 18 Jun 2009, 07:11 PM
Hi ,
I set the default button for my search button to trigger when user do the search and hit enter like this
 <asp:Panel id="pnlbtnSearch" runat="server" defaultButton="btnSearch"
                <table id="FilterControls" border="0" cellspacing="2"  style="margin-top: 20px"
                    <tr style="margin-left: 25px;padding-bottom:15px"
                        <td  class="labels" align="left" valign="top" style="padding-right:15px"
                         
                            <asp:label id="lblService" enableviewstate="False"  runat="server"  
                                text="Service:"></asp:label> 
                        </td> 
                        <td  align="left" valign="top" colspan="2" > 
                             <asp:textbox id="uxService" runat="server" width="195px"></asp:textbox> 
                        </td> 
                    </tr> 
                     
                     
                    <tr> 
                        <td style="height:30px" >  
                        </td> 
                        <td  style="text-align:left" ><a><asp:LinkButton ID="btnSearch" runat="server" Text="Search" CssClass="searchBtn" ToolTip="Search" 
                                OnClick="uxSubmit_Click" Style="float: right;"></asp:LinkButton></a</td> 
                        <td style="text-align:right"  > 
                        <a> 
                            <asp:LinkButton ID="uxReset" runat="server" Text="Reset" ToolTip="Reset" CssClass="cancelBtn" 
                                OnClick="uxReset_Click" Style="float: right;"></asp:LinkButton></a
                                                 
                                 
                             
                        </td> 
                    </tr> 
                </table></asp:Panel> 
but hitting enter trigger the delete button on my radGrid.here is how delete button binded on my grid.
<telerik:GridButtonColumn ConfirmText="Warning! This will remove this service and any services underneath." 
                        ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton" 
                        CommandName="Delete" Text="Delete" ImageUrl="~/Admin/ServiceFinder/images/Delete.gif" 
                        UniqueName="DeleteColumn"
                        <HeaderStyle Width="40px" /> 
                        <ItemStyle Width="40px" /> 
                    </telerik:GridButtonColumn> 
 Any ideas why this is happening? or any other way how I can handle to set  default button for hhe user to hit enter to trigger the search button?

Thanks,
Yoni

9 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 19 Jun 2009, 07:17 AM
Hello Yoni ,

You can use the approach presented on this online demo of RadGrid for ASP.NET AJAX:

http://demos.telerik.com/aspnet-ajax/grid/examples/programming/webmailgrid/defaultcs.aspx

The idea is to intercept the onkeydown event of the textbox filter, cancel the event bubbling on the client and trigger the click() method of the button explicitly from the client.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Yoni
Top achievements
Rank 1
answered on 19 Jun 2009, 02:02 PM

Hi Sebastian,

Thank you for your quick resonse.I tried like what you told me ,it stops triggering the delete button but couldn't trigger the search button.What did I missed?

function SuppressBubbling(evt) {  
        if (evt.keyCode == "13") {  
              
            evt.cancelBubble = true;  
            evt.returnValue = false;  
 
            if (evt.stopPropagation) {  
                evt.stopPropagation();  
                evt.preventDefault();  
            }  
             
            $get("<%= btnSearch.ClientID %>").click();  
             
        }  
    }  
.  
.  
.  
<table id="FilterControls" border="0" cellspacing="2"  style="margin-top: 20px">  
                    <tr style="margin-left: 25px;padding-bottom:15px">  
                        <td  class="labels" align="left" valign="top" style="padding-right:15px">  
                          
                            <asp:label id="lblService" enableviewstate="False"  runat="server"   
                                text="Service:"></asp:label> 
                        </td> 
                        <td  align="left" valign="top" colspan="2" > 
                             <asp:textbox id="uxService" runat="server" width="195px" onkeydown="SuppressBubbling(event)"></asp:textbox> 
                        </td> 
                    </tr> 
                      
                      
                    <tr> 
                        <td style="height:30px" >   
                        </td> 
                        <td  style="text-align:left" ><a><asp:LinkButton ID="btnSearch" runat="server" Text="Search" CssClass="searchBtn" ToolTip="Search" 
                                OnClick="uxSubmit_Click" Style="float: right;"></asp:LinkButton></a</td> 
                        <td style="text-align:right"  > 
                        <a> 
                            <asp:LinkButton ID="uxReset" runat="server" Text="Reset" ToolTip="Reset" CssClass="cancelBtn" 
                                OnClick="uxReset_Click" Style="float: right;"></asp:LinkButton></a>  
                                                  
                                  
                              
                        </td> 
                    </tr> 
                </table> 

0
Sebastian
Telerik team
answered on 19 Jun 2009, 02:12 PM
Hello Yoni ,

Since your search button resides inside html table with explicitly set id, verify that the $get("<%=btnSearch.ClientID %>") method returns a valid reference to the button and its OnClick server event is raised as expected.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Yoni
Top achievements
Rank 1
answered on 19 Jun 2009, 04:02 PM
Hi ,
I am not gettign what you saying.But I have noticed that the code is working on IE but not on firefox.Can you put what you saying on sample code.

Thanks gain.
Yoni
0
Sebastian
Telerik team
answered on 24 Jun 2009, 04:15 PM
Hello Yoni ,

What I had in mind is that you can debug your javascript code (using debugger; keyword in it) to see whether the button is referenced properly and its server event is fired. Can you also confirm that the online demo pointed in my first reply behaves properly under IE and FF?

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Yoni
Top achievements
Rank 1
answered on 24 Jun 2009, 07:41 PM
Hi,
I was able to confirm that the button is referenced properly and the server event  is raised correctly.Even though the script stops triggering the delete button but couldn't trigger the search button.The demo example works on both IE and FF. I still couldn't figure out the issue.

Thanks,
Yoni
0
Sebastian
Telerik team
answered on 25 Jun 2009, 07:34 AM
Hello Yoni ,

At this point the best means to progress in our investigation is to isolate a simple working version of your project, illustrating the issue, and send it enclosed to a regular support ticket. Thus I will examine your complete code logic in detail and will get back to you with more info on the subject.

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Yoni
Top achievements
Rank 1
answered on 26 Jun 2009, 03:21 PM
HI Sebastian,
Actually the server is event is not raised with the client script added. The server event was working before client event added on CheckBox's attribute.

Thanks,
Yoni
0
Sebastian
Telerik team
answered on 30 Jun 2009, 07:46 AM
Hello Yoni ,

Does removing the id from the html table which wraps the textbox produces different result? If not, please submit the requested example. Thus I will be able to research the matter further and provide more to-the-point explanation.

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Yoni
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Yoni
Top achievements
Rank 1
Share this question
or