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

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

1 Answer 45 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ranganath
Top achievements
Rank 1
Ranganath asked on 06 Aug 2008, 12:51 PM

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:08 AM
Hello Ranganath,

I tested the setup which you mentioned, and the control behaved as expected - the selectedIndexChanged handler was only raised when selecting an item from the combo.
Attached to this message, is the code, which I used for testing.

Regards,
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