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

How to prevent ComboBox selected Event, which is Firing Again and again

1 Answer 84 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ranganath
Top achievements
Rank 1
Ranganath asked on 07 Aug 2008, 11:30 AM

Hi,

First let me Explain .aspx codeā€¦.

<table cellpadding="0" cellspacing="0" width="100%" style="text-align: center">

<tr> <td>

<telerik:RadGrid ID="rg_AddPorts" runat="server" AllowPaging="True" Skin="Default" GridLines="Horizontal" PageSize="10" Width="100%" OnNeedDataSource="rg_AddPorts_NeedDataSource"                                 OnInsertCommand="rg_AddPorts_InsertCommand" OnItemDataBound="rg_AddPorts_ItemDataBound"                                OnUpdateCommand="rg_AddPorts_UpdateCommand">

<MasterTableView CommandItemDisplay="TopAndBottom" AutoGenerateColumns="false" DataKeyNames="Port_PortNo"                                    EditMode="EditForms" CommandItemSettings-AddNewRecordText="Add Ports">                                    <Columns>

<telerik:GridBoundColumn ReadOnly="true" Visible="false" HeaderText="Port ID" DataField="Port_PortNo"                                            UniqueName="Port_PortNo" />                                        <telerik:GridBoundColumn ReadOnly="false" HeaderText="Name" DataField="Port_PortName"                                            UniqueName="Port_PortName" HeaderStyle-Width="20%" />                                        <telerik:GridBoundColumn ReadOnly="false" HeaderText="Type" DataField="Port_PortType"                                            UniqueName="Port_PortType" HeaderStyle-Width="20%" />                                        <telerik:GridBoundColumn ReadOnly="false" HeaderText="City" DataField="Port_City"                                            UniqueName="Port_City" HeaderStyle-Width="20%" />                                        <telerik:GridTemplateColumn HeaderText="Status" Visible="false" HeaderStyle-Width="7%">

<ItemTemplate>

<asp:Label ID="lblPlaceNo" runat="server" Text='<%#Bind("Place_No") %>'></asp:Label> </ItemTemplate>                                        </telerik:GridTemplateColumn>                                        <telerik:GridTemplateColumn HeaderText="Status" Visible="false" HeaderStyle-Width="7%">

<ItemTemplate>

<asp:Label ID="Label1" runat="server" Text='<%#Bind("Port_Status") %>'></asp:Label></ItemTemplate>                                        </telerik:GridTemplateColumn>                                       <telerik:GridTemplateColumn HeaderText="Status" HeaderStyle-Width="7%">                                            <ItemTemplate>                                                <telerik:RadComboBox ID="rcbxPorts" Skin="Default" Width="100Px" Text='<%#Bind("Lookup_Value") %>'                                                    OnSelectedIndexChanged="rcbxPorts_SelectedIndexChanged" runat="server" AutoPostBack="true">                                                </telerik:RadComboBox>                                            </ItemTemplate>                                        </telerik:GridTemplateColumn>                                        <telerik:GridEditCommandColumn HeaderStyle-Width="7%">                                        </telerik:GridEditCommandColumn>                                    </Columns>

<EditFormSettings EditFormType="Template">                                        <EditColumn UniqueName="EditCommandColumn1">                                        </EditColumn>

<FormTemplate>

<!-- Grid Table Designing->

<table cellpadding="0" cellspacing="0" width="100%" class="TblMaster">                                                <tr><td style="width: 15%" align="left" class="tbtextbold">                                                        Port Name</td><td align="left">                                                        <telerik:RadTextBox Text='<%#Eval("Port_PortName") %>' ID="txtPortName" runat="server">                                                        </telerik:RadTextBox>                                                    </td> <td style="width: 15%" align="left" class="tbtextbold">                                                        Port Type

</td><td align="left">                                                        </td><td align="left">                                                        <telerik:RadComboBox ID="rcbxPortsStatus" runat="server" MarkFirstMatch="True" Text='<%#Bind("Lookup_Value") %>'                                                            Skin="Default" EmptyMessage="Select Status" Width="130px" OnSelectedIndexChanged="rcbxPortsStatus_SelectedIndexChanged">                                                        </telerik:RadComboBox>                                                    </td></tr><tr><td align="left" class="tbtextbold">                                                        Address1</td>

<tr> <td colspan="6" align="center">                                                        <asp:Button runat="server" ID="btnAddPorts" Text='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "Insert" : "Update" %>'                                                            CommandName='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "PerformInsert" : "Update" %>'                                             CssClass="btn1" />&nbsp;&nbsp;&nbsp;                                                        <asp:Button runat="server" ID="Button1" Text="Cancel" CssClass="btn1" CausesValidation="false"                                                            CommandName="Cancel" />                                                    </td></tr></table><!-- End Grid page Designing->                                        </FormTemplate> </EditFormSettings>                               </MasterTableView></telerik:RadGrid></td></tr></table>

 

C#code:-

protected void rcbxPorts_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)

{

XYZā€¦.

}

Prob:- when ever I try to Add/Edit a record/Refresh the Grid, all the times its firing

OnSelectedIndexChanged="rcbxPorts_SelectedIndexChanged" Event.

But this prob I am facing only in Few Systems not in all the systems.

Please help me in this regards.

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 11 Aug 2008, 06:50 AM
Hi Ranganath,

The question set forth here, was addressed in the other forum post that you have on the matter.
In order to avoid duplicate posts, we can continue our communication there.

Greetings,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Ranganath
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or