Radtoolbar inside radcomobobox selectedindex problem

2 posts, 0 answers
  1. mohamed
    mohamed avatar
    311 posts
    Member since:
    Mar 2011

    Posted 23 Sep 2011 Link to this post


    <
    telerik:RadToolBar ID="RadToolBar1" runat="server" OnClientButtonClicking="onToolBarClientButtonClicking"
                        OnButtonClick="RadToolBar1_ButtonClick" Width="100%">
                        <Items>
                            <telerik:RadToolBarButton Text="<%$ Resources:FormName, Addnew %>" CommandName="InitInsert"
                                ImageUrl="../../images/AddRecord.gif" Visible='<%# !RadGrid1.MasterTableView.IsItemInserted %>'>
                            </telerik:RadToolBarButton>
                            <telerik:RadToolBarButton Text="<%$ Resources:FormName, Filter %>" CommandName="Filter"
                                ImageUrl="../../images/Filter 3.gif">
                            </telerik:RadToolBarButton>
                            <telerik:RadToolBarButton Text="<%$ Resources:FormName, Refresh %>" CommandName="RebindGrid"
                                ImageUrl="../../images/Refresh.gif">
                            </telerik:RadToolBarButton>
                            <telerik:RadToolBarButton runat="server" Value="HeaderDisplay">
                                <ItemTemplate>
                                    <table>
                                        <tr>
                                            <td align="right">
                                                <telerik:RadComboBox runat="server" ID="DeleteOption" OnSelectedIndexChanged="DeleteOption_SelectedIndexChanged"
                                                    AutoPostBack="true" AppendDataBoundItems="true">
                                                    <Items>
                                                        <telerik:RadComboBoxItem runat="server" Text="All" Value="All" />
                                                        <telerik:RadComboBoxItem runat="server" Text="Deleted" Value="Deleted" />
                                                        <telerik:RadComboBoxItem runat="server" Text="Not Deleted" Value="Not Deleted" />
                                                    </Items>
                                                </telerik:RadComboBox>
                                            </td>
                                        </tr>
                                    </table>
                                </ItemTemplate>
                            </telerik:RadToolBarButton>
                        </Items>
                    </telerik:RadToolBar>

    In my problem in after selectedindex changed to deleted ,
    After values assigned comobox changed into first value

    protected void DeleteOption_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
            {
                GridCommandItem commandItem = RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)[0] as GridCommandItem;
                RadToolBar toolBar = commandItem.FindControl("RadToolBar1") as RadToolBar;
                RadToolBarItem textItem = toolBar.FindItemByValue("HeaderDisplay");
                RadComboBox Comobovalue = (RadComboBox)textItem.FindControl("DeleteOption");
                var DeleteOption = Comobovalue.SelectedValue;
     
                if (DeleteOption == "All")
                {
                    using (var db = new DoskContractServicesDataContext(Globals.strCon))
                    {
                        var result = (from a in db.DSProjectMasters
                                      join b in db.dsdatamasters
                                      on a.ClientCode equals b.clientcode into Lcat
                                      from Lclien in Lcat.DefaultIfEmpty()
                                      join c in db.dsdatamasters
                                      on a.MainContractor equals c.clientcode into Lmain
                                      from Lmaincon in Lmain.DefaultIfEmpty()
                                      select new
                                      {
                                          a.ProjectID,a.ProjectTitle,a.Duration,a.DtCommencement,a.DtCompletion,a.EstimateDistance,a.ContractAmount,a.ProjectCode,
                                          Lclien.clientname,maincon = Lmaincon.clientname
                                      }).ToList();
                        RadGrid1.DataSource = result;
                        RadGrid1.Rebind();
                        Comobovalue.Text = "All";
                    }
                }
                else if (DeleteOption == "Deleted")
                {
                    using (var db = new DoskContractServicesDataContext(Globals.strCon))
                    {
                        var result = (from a in db.DSProjectMasters
                                      join b in db.dsdatamasters
                                      on a.ClientCode equals b.clientcode into Lcat
                                      from Lclien in Lcat.DefaultIfEmpty()
                                      join c in db.dsdatamasters
                                      on a.MainContractor equals c.clientcode into Lmain
                                      from Lmaincon in Lmain.DefaultIfEmpty()
                                      where a.Status == "DEL"
                                      select new
                                      {
                                          a.ProjectID,a.ProjectTitle,a.Duration,a.DtCommencement,a.DtCompletion,a.EstimateDistance,a.ContractAmount,a.ProjectCode,Lclien.clientname,
                                          maincon = Lmaincon.clientname
                                      }).ToList();
                        RadGrid1.DataSource = result;
                        RadGrid1.Rebind();
                        Comobovalue.Text = "Deleted";
                    }
                }
                else if (DeleteOption == "Not Deleted")
                {
                    using (var db = new DoskContractServicesDataContext(Globals.strCon))
                    {
                        var result = (from a in db.DSProjectMasters
                                      join b in db.dsdatamasters
                                      on a.ClientCode equals b.clientcode into Lcat
                                      from Lclien in Lcat.DefaultIfEmpty()
                                      join c in db.dsdatamasters
                                      on a.MainContractor equals c.clientcode into Lmain
                                      from Lmaincon in Lmain.DefaultIfEmpty()
                                      where a.Status != "DEL"
                                      select new
                                      {
                                          a.ProjectID,a.ProjectTitle,a.Duration,a.DtCommencement,a.DtCompletion,a.EstimateDistance,a.ContractAmount,
                                          a.ProjectCode,Lclien.clientname,maincon = Lmaincon.clientname
                                      }).ToList();
                        RadGrid1.DataSource = result;
                        RadGrid1.Rebind();
                        Comobovalue.Text = "Not Deleted";
                    }
                }
            }


    Replay as soon possible 


    Thanks,
    Mohamed.
  2. mohamed
    mohamed avatar
    311 posts
    Member since:
    Mar 2011

    Posted 23 Sep 2011 Link to this post

    Problem Resolved,

    using Radgrid_PreRender

    Thanks,
    Mohamed.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top