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

SelectedIndexChanged how to load RadGrid1_ItemDataBound

3 Answers 140 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mohamed
Top achievements
Rank 1
mohamed asked on 29 Sep 2011, 06:52 AM
Hello ,


If selected index is changed how to load on RadGrid1_ItemDataBound,
reply soon

Thanks,
Mohamed.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 29 Sep 2011, 07:13 AM
Hello Mohamed,

One suggestion is to call the Rebind() method fro the selectedIndexChanged Event. Then the ItemDataBound event will fire.
C#:
protected void RadGrid1_SelectedIndexChanged(object sender, EventArgs e)
   {
       RadGrid1.Rebind();
   }

Thanks,
Shinu.
0
Jayesh Goyani
Top achievements
Rank 2
answered on 29 Sep 2011, 07:14 AM
Hello,

http://www.telerik.com/help/aspnet-ajax/grid-commands-that-invoke-rebind-implicitly.html

select command not invoke rebind automatically so you have to call RadGrid1.Rebind() manually in your event.
and Rebind() event invoke itemDataBound.

Thanks,
Jayesh Goyani
0
mohamed
Top achievements
Rank 1
answered on 29 Sep 2011, 07:17 AM
protected void RadComboBox_Route_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            RadComboBox comboroute = (RadComboBox)sender;
            GridEditableItem editedItem = comboroute.NamingContainer as GridEditableItem;
            RadComboBox RadComboBox_Route = editedItem.FindControl("RadComboBox_Route") as RadComboBox;
            RadComboBox RadComboBox_Location = editedItem.FindControl("RadComboBox_Location") as RadComboBox;
 
            RadComboBox_Location.Text = "";
            RadComboBox_Location.SelectedValue = "";
            RadComboBox_Location.ClearSelection();
            RadComboBox_Location.Items.Clear();
            string LocationWise = ("select distinct locationcode, locationplan  from dslocationmaster where status <> 'del' and routecode = '" + RadComboBox_Route.SelectedValue + "' ");
            RadComboBox_Location.DataSource = oDBClientADO.GetDataTable(LocationWise);
            RadComboBox_Location.DataValueField = "locationcode";
            RadComboBox_Location.DataTextField = "locationplan";
            RadComboBox_Location.DataBind();
            RadComboBox_Location.Items.Insert(0, new RadComboBoxItem("Select Location", "-1"));
 
            using (var db = new DoskContractServicesDataContext(Globals.strCon))
            {
                var datecomm = (from a in db.dsroutemasters
                                where a.routecode == RadComboBox_Route.SelectedValue
                                select new { a.dtcommencement, a.dtcompletion }).ToList();
                Dtcomm = Convert.ToDateTime(datecomm[0].dtcommencement.ToString());
                Dtcomplete = Convert.ToDateTime(datecomm[0].dtcompletion.ToString());
            }
            RadGrid1.Rebind();
        }

<EditFormSettings CaptionFormatString="Create" EditFormType="Template" PopUpSettings-Width="600"
                PopUpSettings-Height="360px">
<tr>
                                                    <td>
                                                    <asp:Label ID="Label8" runat="server" ForeColor="Red" Text="*" Width="1px"></asp:Label>
                                                    <asp:Label runat="server" Text="<%$ Resources:FormName, RouteCmmon %>"></asp:Label>                                                        
                                                    </td>
                                                    <td>
                                                        <telerik:RadComboBox ID="RadComboBox_Route" runat="server" AutoPostBack="true" AppendDataBoundItems="true" DataTextField="routecode" DataValueField="routename"
                                                             Width="85%" OnSelectedIndexChanged="RadComboBox_Route_SelectedIndexChanged" >
                                                        </telerik:RadComboBox>
                                                    </td>
                                                </tr>


But i selected value are not in the radcombobox ,
what i assigned that not fixed,
Please refer image,
if i choose any route based location assigned ,
if i called rebind() that are not assigned ,
I'm waiting for ur reply,

Thanks,
Mohamed.
Tags
Grid
Asked by
mohamed
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Jayesh Goyani
Top achievements
Rank 2
mohamed
Top achievements
Rank 1
Share this question
or