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

Grid delete button on Mozilla 4.x

1 Answer 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kalyani Mantripragada
Top achievements
Rank 1
Kalyani Mantripragada asked on 23 May 2011, 07:33 PM

Hello. I have a simple page containing a text box and a rad grid. I have attached a delete button on the grid row has a confirm text displayed on click of the btn.

The problem I am having is: If I have the cursor on the text box and I hit enter, its invoking the rad grid delete event, strating with delete confirm prompt. I do not want this to happen. I need to hook the enter key to some other events. And this is happening only on Mozilla. rest of the browsers do not invoke the delete event.

Any clues/fixes for this behaviour. Appreciate your help. thanks

code below:

 

<asp:textbox id="txtMLSNumber"  runat="server" Width="110px"></asp:textbox>
 <telerik:RadGrid ID="grdPartials" DataSourceID ="ObjectDataSource1" CssClass="RemoveBorders"  
        Skin="Outlook"   runat="server" GridLines="None" AutoGenerateColumns="False" 
        Width="690px" height="196px">
        <AlternatingItemStyle BackColor="#DDECFE" />
<MasterTableView datasourceid="ObjectDataSource1" GridLines=none  AllowAutomaticDeletes="true" EnableNoRecordsTemplate=true  DataKeyNames ="PartialId,PropType" >
<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
  
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>               
        <telerik:GridHyperLinkColumn HeaderText = ""  ItemStyle-HorizontalAlign="Left" Text ="Edit"  
        UniqueName="lnkEdit" HeaderStyle-Font-Bold="false" HeaderStyle-Wrap="false"
        HeaderStyle-Width="40px"
        </telerik:GridHyperLinkColumn
        <telerik:GridBoundColumn DataField="PartialId" Visible =true  HeaderText="Partial Id" ItemStyle-Width="100px" HeaderStyle-Width="100px"  ItemStyle-Wrap=false  HeaderStyle-Wrap="false"
            MaxLength="0" UniqueName="PartialId">
<HeaderStyle Wrap="False"></HeaderStyle>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="StreetNumber" HeaderText="Street Number" ItemStyle-Width="100px" HeaderStyle-Width="100px"  ItemStyle-Wrap=false  HeaderStyle-Wrap="false"
            UniqueName="StreetNumber">
<HeaderStyle Wrap="False"></HeaderStyle>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="StreetName" HeaderText="Street Name" ItemStyle-Width="100px" HeaderStyle-Width="100px"  ItemStyle-Wrap=false  HeaderStyle-Wrap="false"
            UniqueName="StreetName">
<HeaderStyle Wrap="False"></HeaderStyle>
  
<ItemStyle Wrap="False"></ItemStyle>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="City" HeaderText="City" UniqueName="City" DataFormatString="<nobr>{0}</nobr>" ItemStyle-Width="100px" HeaderStyle-Width="100px"  ItemStyle-Wrap=false  HeaderStyle-Wrap="false">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="PropType" HeaderText="Prop Type" ItemStyle-Width="100px" HeaderStyle-Width="100px"  ItemStyle-Wrap=false  HeaderStyle-Wrap="false"
            UniqueName="PropType">
<HeaderStyle Wrap="False"></HeaderStyle>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="CreateDate" HeaderText="Create Date"  DataFormatString="{0:MM/dd/yyyy}"  ItemStyle-Width="100px" HeaderStyle-Width="100px"  ItemStyle-Wrap=false  HeaderStyle-Wrap="false"
            UniqueName="CreateDate">
        </telerik:GridBoundColumn>          
        <telerik:GridButtonColumn ConfirmText="Delete this record?" ConfirmDialogType="RadWindow"  
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                        UniqueName="DeleteColumn">
                        <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                    </telerik:GridButtonColumn>
  
  </Columns
  <NoRecordsTemplate>
    <div style="text-align:center;padding-top:70px;font-size:medium">No Partial Listings Found!!!</div>
    <br />
  </NoRecordsTemplate>
</MasterTableView>
        <SelectedItemStyle  />
        <HeaderStyle BackColor="#D6E7FC" />
        <ClientSettings Scrolling-ScrollHeight =200>
            <Selecting AllowRowSelect="True" />            
            <Scrolling AllowScroll =true UseStaticHeaders =true />                       
            <Resizing AllowColumnResize="True" AllowRowResize="false" />
        </ClientSettings>        
        <ActiveItemStyle BackColor="#CC0099" />
    </telerik:RadGrid>
    <asp:ObjectDataSource 
            ID="ObjectDataSource1" 
            runat="server" 
            SelectMethod="GetPartials" 
            TypeName = "Partials"
            DeleteMethod ="DeletePartials"  
            >           
            <DeleteParameters>
            <asp:Parameter Name="PartialId"  Type ="String"  />                   
            <asp:Parameter Name="PropType"  Type ="String"  />                                          
            </DeleteParameters>
    </asp:ObjectDataSource>

 

 

 

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 26 May 2011, 03:11 PM
Hello Kalyani,

As said in the support thread that you have opened on this topic, the behavior that you describe is not directly related with RadGrid itself. It can be replicated with native GridView and TextBox.

There are different ways to overcome this behavior:
- to use an inactive button as default button:
<form id="form1" runat="server" defaultbutton="Button1">
<div style="display: none">
    <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return false;" />
</div>
....
</form>

- to set the defaultbutton to be exactly the one that you want to make a postback on enter key press.

- to only execute javascript, you could wire the keydown event of the document, if the key is Enter, cancel its default action and perform your custom javascript.

Greetings,
Tsvetina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
Kalyani Mantripragada
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or