Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
73 views
Hi
I downloaded trial version of ASP.net AJAX RadControls 2013 Q2 and I want to test it on my host/CDN but I can't find "CDN resource package"  anywhere. where is it?
Mahdi
Top achievements
Rank 1
 answered on 10 Jul 2013
3 answers
140 views
I've had this same code for years and it has always worked. Now with the latest release it is broken.  I'm not using any new features or anything like that. When this code runs the cells shift and become huge. So basically the cells become 5 times as big (in height) and the columns shift over (leaving a broken appearance). This code is abbreviated of course and called from the grid_prerender event during a post back. The grid is in an update panel. Also I'm using IE10. It works in 2013.1.417.45. As soon as i switch to the new dlls, it breaks.


foreach (GridDataItem item in grid.Items)
          {
              //Get the instance of the right type
              GridDataItem row = item as GridDataItem;
              try
              {
                  
                  string sColName = String.Empty;
                  string sValue = String.Empty;
                  string sValueField = String.Empty;
 
                  foreach (GridColumn col in grid.MasterTableView.Columns)
                  {
                      sColName = col.UniqueName;
 
                      if (sColName.Contains("String") && grid.MasterTableView.GetColumnSafe(sColName.Replace("String", "")) != null)
                      {
                          // If String is present we will use the numeric field equivalent without "String" for calculations
                          sValueField = sColName.Replace("String", "");
                      }
                      else
                      {
                          sValueField = sColName;
                      }
 
                      sValue = row[sValueField].Text.Replace("$", "").Replace(",", "").Replace("%", "").Replace("M", "");
 
                   
 
                      if (sValue.IsNumeric())
                      {
                           
                               
                              row[sColName].BackColor = ColorTranslator.FromHtml("#fce9b3");
                           
                      }
 
                      // Get rid of the border
                      row[sColName].BorderColor = Color.Transparent;
 
 
                       
                  }
              }

Also here is my markup in case you're interested:
<asp:UpdatePanel ID="upnlGridOverview" runat="server" UpdateMode="Conditional">
       <ContentTemplate>           
           <telerik:RadGrid ID="gridOverview" runat="server" AllowPaging="True" AllowSorting="True"
               AllowCustomPaging="True" ShowGroupPanel="false" AutoGenerateColumns="false" PageSize="10"
               MasterTableView-AllowCustomPaging="true" Skin="swExcel2010" EnableEmbeddedSkins="false"
               EnableEmbeddedBaseStylesheet="false" ShowFooter="false" OnNeedDataSource="gridOverview_NeedDataSource">
               <MasterTableView TableLayout="Fixed" OverrideDataSourceControlSorting="true" Width="100%"
                   Visible="true">
                   <PagerTemplate>
                       <uc1:GridPagerTemplate ID="GridPagerTemplate2" runat="server" />
                   </PagerTemplate>
                   <PagerStyle AlwaysVisible="true" />
                   <NoRecordsTemplate>
                       <uc2:GridNoRecordsTemplate ID="GridNoRecordsTemplate1" runat="server" />
                   </NoRecordsTemplate>
                   <Columns>
                       <telerik:GridBoundColumn UniqueName="Date" SortExpression="GroupDate" HeaderText="Date"
                           DataField="DateString" ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Left"
                           FooterAggregateFormatString="Total Dates:  {0:#,0}" FooterStyle-HorizontalAlign="Right"
                           Aggregate="Count">
                           <HeaderStyle></HeaderStyle>
                       </telerik:GridBoundColumn>
                       <telerik:GridBoundColumn UniqueName="Visitors" DataFormatString="{0:#,0}" SortExpression="Visitors"
                           HeaderText="Visits" DataField="Visitors" HeaderStyle-HorizontalAlign="Right"
                           ItemStyle-HorizontalAlign="Right" FooterAggregateFormatString="Avg:  {0:#,0}"
                           FooterStyle-HorizontalAlign="Right" Aggregate="Avg">
                           <HeaderStyle></HeaderStyle>
                       </telerik:GridBoundColumn>
      
                   </Columns>
                   <SortExpressions>
                   </SortExpressions>
               </MasterTableView>
               <GroupingSettings GroupContinuesFormatString="" GroupContinuedFormatString="" />
           </telerik:RadGrid>
       </ContentTemplate>
   </asp:UpdatePanel>

Eyup
Telerik team
 answered on 10 Jul 2013
1 answer
208 views
Hi,

I'm trying to export a radgrid to PDF and set the alignment of the headers.
I've been through a lot of posts on this forum, but nothing I can find seems to work.

Right now I have this:

Private Sub rgLec_ItemCreated(sender As Object, e As GridItemEventArgs) Handles rgLec.ItemCreated
        If (bPrintReport And (TypeOf e.Item Is GridHeaderItem)) Then
            For Each cell As TableCell In e.Item.Cells
                cell.Style("text-align") = "left"
            Next
        End If
End Sub

However, this doesn't change anything. The header text is still centered.
Can anyone tell me what I'm doing wrong?

Cheers,
CJ
Princy
Top achievements
Rank 2
 answered on 10 Jul 2013
4 answers
268 views
Hi All,

is there any way to access a control like textbox present in nestedviewtemplate in onDataBound client side event of radgrid?
Jay
Top achievements
Rank 1
 answered on 10 Jul 2013
1 answer
107 views
Hi,

Is it possible to customise the header context menu on the RadGrid so that you can have filtering by a given set of values? I have a column that has 3 possible values so I would like to user to be able to select one of these from a list (so the list would contain All, Active, Inactive, & Pending).

If I switch on the column filtering it allows this, but as this is the only column that is filtered then having an extra row under the header looks a bit rubbish!

Thanks,

Dan.
Marin
Telerik team
 answered on 10 Jul 2013
7 answers
348 views
I am having a strange thing happen when I try to sort a RadGrid.  As soon as I do a sort, the RadComboBox options in my filter under "Market" disappear, and I can't figure out why.  Any thoughts by anybody??

<telerik:RadScriptManager runat="server" />
<telerik:RadAjaxManager runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="gridResults">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="gridResults" UpdatePanelRenderMode="Inline" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
  
<telerik:RadGrid runat="server" ID="gridResults" AutoGenerateColumns="false" AllowFilteringByColumn="true" AllowSorting="true" OnSortCommand="gridResults_OnSortCommand">
    <MasterTableView TableLayout="Fixed">
        <Columns>
            <telerik:GridBoundColumn HeaderText="Loan Number" DataField="LoanNumber" UniqueName="LoanNumber" />
            <telerik:GridBoundColumn HeaderText="FS Market" DataField="FSMarket" AllowFiltering="true" UniqueName="FSMarket">
                <FilterTemplate
                    <telerik:RadComboBox ID="drpdwnFSMarket" runat="server" Width="90" AllowCustomText="false" 
                                DataTextField="FSMarket" DataValueField="FSMarket" CheckBoxes="true"
                                AutoPostBack="true" DropDownWidth="250px" />
                </FilterTemplate>
            </telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>



protected void Page_Load(object sender, EventArgs e)
{
     if (!IsPostBack)
     {
         BindGrid();
         BindGridDropdowns();
     }
 }
 protected void gridResults_OnSortCommand(object o, GridSortCommandEventArgs e)
 {
     BindGrid();
     BindGridDropdowns();
 }
 private void BindGridDropdowns()
 {
     DataTable dt = GetMarketDropdown();
     RadComboBox rcb = (RadComboBox)FindControl("drpdwnFSMarket", gridResults.MasterTableView.Controls);
     rcb.DataSource = dt;
     rcb.DataBind();
     dt.Dispose();
 }
 private void BindGrid()
 {
     DataTable dt = GetResults();
     gridResults.DataSource = dt;
     gridResults.DataBind();
     dt.Dispose();
 }
 private Control FindControl(string uniqueID, ControlCollection cc)
 {
     Control c = null;
     foreach (Control ctrl in cc)
     {
         if (ctrl.ID != null && ctrl.ID == uniqueID)
         {
             c = ctrl;
             break;
         }
         if (ctrl.HasControls())
         {
             c = FindControl(uniqueID, ctrl.Controls);
             if (c != null)
             {
                 break;
             }
         }
     }
     return c;
 }

This seems pretty forward to me?  I bind the grid and then the RadComboBox in the filter.  Everything looks fine.  I do the exact same thing after the sort, and the options are gone. 

Any help would be appreciated!!!

Viktor Tachev
Telerik team
 answered on 10 Jul 2013
6 answers
122 views
i have the export to excel funcionality in my current page with a radgrid.
if i click on the export to excel it exports to excel but until i do a page reload none of the other controls works in my page .
neither sorting, nor filtering or any other controls in the current page works properly once i have this export to excel clicked.
the only way is to reload the page.
how can i get rid of this behaviour of the page.
Kostadin
Telerik team
 answered on 10 Jul 2013
6 answers
300 views
I have a RadGrid that pops in a RadWindow when I try to edit and update the changes, the window doesn't postback. The following error shows on the `Update' link:

javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$TabContainer1$TabPanel7$EditPORadWindow$C$EditPORadGrid$ctl00$ctl05$UpdateButton", "", true, "", "", false, true))




The code:

Please see the following code:

**`ASPX`code:**
      
<ajaxToolkit:TabPanel runat="server" HeaderText="TabPanel7" ID="TabPanel7">
        <HeaderTemplate>Edit/Delete PO Reports</HeaderTemplate>
        <ContentTemplate>
        <br />       
        <asp:UpdateProgress ID="UpdateProgress2" runat="server" AssociatedUpdatePanelID="UpdatePanel4">
        <ProgressTemplate>
        <div style="background-color: Gray; filter:alpha(opacity=60); opacity:0.60; width: 100%; top: 0px; left: 0px; position: fixed; height: 100%;">
        </div>
          <div style="margin:auto;
              font-family:Trebuchet MS;
              filter: alpha(opacity=100);
              opacity: 1;
              font-size:small;
              vertical-align: middle;
              top: 45%;
              position: fixed;
              right: 45%;
              color: #275721;
              text-align: center;
              background-color: White;
              height: 100px;
              ">
                <table style=" background-color: White; font-family: Sans-Serif; text-align: center; border: solid 1px #275721; color: #275721; width: inherit; height: inherit; padding: 15px;">
                <tr>
                <td style=" text-align: inherit;"><img src="images/loadingIcon.gif" alt="Loading"  /></td>
                <td style=" text-align: inherit;"><span style="font-family: Sans-Serif; font-size: medium; font-weight: bold; font">Loading...</span></td>
                </tr>
                </table>
                </div>
             </ProgressTemplate>
          </asp:UpdateProgress>
          <asp:UpdatePanel ID="UpdatePanel4" runat="server">
                <ContentTemplate>
                Enter a Saudi Aramco PO Number:
            <telerik:RadComboBox ID="EditPORadComboBox" runat="server"
                DataSourceID="SAPOSqlDataSource" DataTextField="SA_PO" DataValueField="SA_PO"
                        MarkFirstMatch="True">
            </telerik:RadComboBox>
                    <asp:SqlDataSource ID="SAPOSqlDataSource" runat="server"
                        ConnectionString="<%$ ConnectionStrings:ROGContext %>"
                        SelectCommand="SELECT [SA_PO] FROM [PODB]"></asp:SqlDataSource>         
              <asp:Button ID="SearchEditPOButton" runat="server" Text="Search"
                onclick="SearchEditPOButton_Click" OnClientClick="togglePoppModality" Height="35px" Width="115px" />     
            </ContentTemplate>
            </asp:UpdatePanel>           
            <br />
            <br />                  
            <telerik:RadWindow ID="EditPORadWindow" runat="server" Width="1800px"
                Height="1000px">
            <ContentTemplate>      
            <asp:UpdatePanel ID="UpdatePanel5" runat="server">
            <ContentTemplate>
            <telerik:RadGrid ID="EditPORadGrid" runat="server" HorizontalAlign="Center"
                CellSpacing="0" GridLines="None" AutoGenerateDeleteColumn="True"
                AutoGenerateEditColumn="True"
                OnUpdateCommand="EditPORadGrid_UpdateCommand"
                onneeddatasource="EditPORadGrid_NeedDataSource" OnItemDataBound="EditPORadGrid_ItemDataBound"
                AllowAutomaticUpdates="True" AllowAutomaticDeletes="True"
                AutoGenerateColumns="False">
            <MasterTableView CommandItemDisplay="Top" DataKeyNames="SA_PO"
                EditMode="PopUp">
                <CommandItemSettings ExportToPdfText="Export to PDF"
                    ShowAddNewRecordButton="False" ShowRefreshButton="True" />
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"
                    Visible="True">
                </RowIndicatorColumn>
                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"
                    Visible="True">
                </ExpandCollapseColumn>
                <Columns>
                <telerik:GridBoundColumn DataField="SA_PO"
                            FilterControlAltText="Filter SA_PO column" HeaderText="SA PO"
                            SortExpression="SA_PO" UniqueName="SA_PO" ReadOnly="true" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="PO_Date"
                            FilterControlAltText="Filter PO_Date column" HeaderText="PO_Date"
                            SortExpression="PO_Date" UniqueName="PO_Date">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Packaging_Details"
                            FilterControlAltText="Filter Packaging_Details column"
                            HeaderText="Packaging Details" SortExpression="Packaging_Details"
                            UniqueName="Packaging_Details">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Country_Origin"
                            FilterControlAltText="Filter Country_Origin column" HeaderText="Country Origin"
                            SortExpression="Country_Origin" UniqueName="Country_Origin">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Required_Document"
                            FilterControlAltText="Filter Required_Document column"
                            HeaderText="Required Document" SortExpression="Required_Document"
                            UniqueName="Required_Document">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Shipping_Label"
                            FilterControlAltText="Filter Shipping_Label column" HeaderText="Shipping Label"
                            SortExpression="Shipping_Label" UniqueName="Shipping_Label">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Special_Instruction"
                            FilterControlAltText="Filter Special_Instruction column"
                            HeaderText="Special Instruction" SortExpression="Special_Instruction"
                            UniqueName="Special_Instruction">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Payment_Terms"
                            FilterControlAltText="Filter Payment_Terms column" HeaderText="Payment Terms"
                            SortExpression="Payment_Terms" UniqueName="Payment_Terms">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Mode_Shipment"
                            FilterControlAltText="Filter Mode_Shipment column" HeaderText="Mode of Shipment"
                            SortExpression="Mode_Shipment" UniqueName="Mode_Shipment">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ExpectedDelivery_Date"
                            FilterControlAltText="Filter ExpectedDelivery_Date column"
                            HeaderText="Expected Delivery Date" SortExpression="ExpectedDelivery_Date"
                            UniqueName="ExpectedDelivery_Date">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Material_No"
                            FilterControlAltText="Filter Material_No column"
                            HeaderText="Material No" SortExpression="ExpectedDelivMaterial_Noery_Date"
                            UniqueName="Material_No">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="QTY"
                            FilterControlAltText="Filter QTY column" HeaderText="QTY" SortExpression="QTY"
                            UniqueName="QTY">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Unit_Price"
                            FilterControlAltText="Filter Unit_Price column" HeaderText="Unit Price"
                            SortExpression="Unit_Price" UniqueName="Unit_Price">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Total_Price"
                            FilterControlAltText="Filter Total_Price column" HeaderText="Total Price"
                            SortExpression="Total_Price" UniqueName="Total_Price" ReadOnly="True">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ROG_PO"
                            FilterControlAltText="Filter ROG_PO column" HeaderText="ROG PO#" ReadOnly="True"
                            SortExpression="ROG_PO" UniqueName="ROG_PO">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Product_Line"
                            FilterControlAltText="Filter Product_Line column" HeaderText="Product Line"
                            SortExpression="Product_Line" UniqueName="Product_Line">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Profile_No"
                            FilterControlAltText="Filter Profile_No column" HeaderText="Profile No"
                            SortExpression="Profile_No" UniqueName="Profile_No">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="IncoTerms"
                            FilterControlAltText="Filter IncoTerms column" HeaderText="IncoTerms"
                            SortExpression="IncoTerms" UniqueName="IncoTerms">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Material_No9COM"
                            FilterControlAltText="Filter Material_No9COM column"
                            HeaderText="Material No.9COM" SortExpression="Material_No9COM"
                            UniqueName="Material_No9COM">
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn UniqueName="Currency" HeaderText="Currency"
                        SortExpression="Currency" FilterControlAltText="Filter Currency column" DataField="Currency" AllowFiltering="true">
                        <ItemTemplate>
                            <%#DataBinder.Eval(Container.DataItem, "Currency")%>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadComboBox runat="server" ID="CurrencyRadComboBox2" EnableLoadOnDemand="true" DataTextField="Currency"
                             DataValueField="Currency" AutoPostBack="true" HighlightTemplatedItems="true" Filter="Contains" OnItemsRequested="CurrencyRadComboBox2_ItemsRequested" OnSelectedIndexChanged="CurrencyRadComboBox2_OnSelectedChangedIndex">
                            </telerik:RadComboBox>
                        </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn UniqueName="Company" HeaderText="Company" SortExpression="Company"
                        FilterControlAltText="Filter Company column" DataField="Company" AllowFiltering="true">
                        <ItemTemplate>
                            <%#DataBinder.Eval(Container.DataItem, "Company")%>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadComboBox runat="server" ID="CompanyRadComboBox" EnableLoadOnDemand="true" DataTextField="Company"
                             DataValueField="Company" AutoPostBack="true" HighlightTemplatedItems="true" Filter="Contains">
                            </telerik:RadComboBox>
                        </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn UniqueName="Country" HeaderText="Country" SortExpression="Country"
                        FilterControlAltText="Filter Country column" DataField="Country" AllowFiltering="true">
                        <ItemTemplate>
                            <%#DataBinder.Eval(Container.DataItem, "Country")%>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadComboBox runat="server" ID="CountryRadComboBox" EnableLoadOnDemand="true" DataTextField="Country"
                             DataValueField="Country" AutoPostBack="true" HighlightTemplatedItems="true" Filter="Contains">
                            </telerik:RadComboBox>
                        </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn DataField="Product_Description"
                            FilterControlAltText="Filter Product_Description column"
                            HeaderText="Product Description" SortExpression="Product_Description"
                            UniqueName="Product_Description">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Size"
                            FilterControlAltText="Filter Size column" HeaderText="Size"
                            SortExpression="Size" UniqueName="Size">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="UOM"
                            FilterControlAltText="Filter UOM column" HeaderText="UOM" SortExpression="UOM"
                            UniqueName="UOM">
                        </telerik:GridBoundColumn>
                </Columns>               
                <EditFormSettings CaptionDataField="SA_PO" CaptionFormatString="Edit Saudi Aramco PO No.: {0}">
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                    </EditColumn>
                </EditFormSettings>
                <PagerStyle PageSizeControlType="RadComboBox" />
            </MasterTableView>
            <ClientSettings>
                <ClientEvents OnRowClick="RowDblClick" />
                <Scrolling AllowScroll="True" UseStaticHeaders="True" />
            </ClientSettings>
            <PagerStyle PageSizeControlType="RadComboBox" />
            <FilterMenu EnableImageSprites="False">
            </FilterMenu>
            </telerik:RadGrid>
            </ContentTemplate>
            </asp:UpdatePanel>
            </ContentTemplate>
            </telerik:RadWindow>
        </ContentTemplate>
        </ajaxToolkit:TabPanel>
    </ajaxToolkit:TabContainer>



    
**C# Code:**

         
protected void SearchEditPOButton_Click(object sender, EventArgs e)
       {
           System.Threading.Thread.Sleep(2000);
           string script = "function f(){$find(\"" + EditPORadWindow.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
           ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
           /*if (EditPORadComboBox.SelectedValue.ToString() != "")
           {
               string editpotxt = EditPORadComboBox.SelectedValue.ToString();
               long editpoint = Convert.ToInt64(editpotxt);
 
               var queryselect = from p in db.PODBs
                                 where p.SA_PO == editpoint
                                 select new
                                 {
                                     p.SA_PO,
                                     p.PO_Date,
                                     p.Packaging_Details,
                                     p.Country_Origin,
                                     p.Required_Document,
                                     p.Shipping_Label,
                                     p.Payment_Terms,
                                     p.Mode_Shipment,
                                     p.ExpectedDelivery_Date,
                                     p.Material_No,
                                     p.QTY,
                                     p.Unit_Price,
                                     p.Total_Price,
                                     p.Product_Line,
                                     p.Profile_No,
                                     p.IncoTerms,
                                     p.Material_No9COM,
                                     p.Currency,
                                     p.Company,
                                     p.Country,
                                     p.Product_Description,
                                     p.Size,
                                     p.UOM
                                 };
 
               EditPORadGrid.Visible = true;
               EditPORadGrid.DataSource = queryselect.ToList();
               EditPORadComboBox.DataBind();
           }*/
       }
 
       protected void EditPORadGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
       {
           if (EditPORadComboBox.SelectedValue.ToString() != "")
           {
               string editpotxt = EditPORadComboBox.SelectedValue.ToString();
               long editpoint = Convert.ToInt64(editpotxt);
 
               var queryselect = from p in db.PODBs
                                 where p.SA_PO == editpoint
                                 select new
                                 {
                                     p.SA_PO,
                                     p.PO_Date,
                                     p.Packaging_Details,
                                     p.Country_Origin,
                                     p.Required_Document,
                                     p.Shipping_Label,
                                     p.Payment_Terms,
                                     p.Mode_Shipment,
                                     p.ExpectedDelivery_Date,
                                     p.Material_No,
                                     p.QTY,
                                     p.Unit_Price,
                                     p.Total_Price,
                                     p.Product_Line,
                                     p.Profile_No,
                                     p.IncoTerms,
                                     p.Material_No9COM,
                                     p.Currency,
                                     p.Company,
                                     p.Country,
                                     p.Product_Description,
                                     p.Size,
                                     p.UOM
                                 };
 
               EditPORadGrid.Visible = true;
               EditPORadGrid.DataSource = queryselect.ToList();
           }
       }
 
       protected void EditPORadGrid_ItemDataBound(object sender, GridItemEventArgs e)
       {
           if (e.Item.IsInEditMode)
           {
               GridEditableItem editedItem = e.Item as GridEditableItem;
 
               var querycurrency = (from c in db.CurrencyDBs
                                    select c.Currency).ToList();
 
               RadComboBox currencycombo = (RadComboBox)editedItem.FindControl("CurrencyRadComboBox2");
 
               foreach (string currencyelement in querycurrency)
               {
                   RadComboBoxItem selecteditem = new RadComboBoxItem();
                   selecteditem.Text = currencyelement.ToString();
                   selecteditem.Attributes.Add("Currency", currencyelement.ToString());
                   currencycombo.Items.Add(selecteditem);
                   selecteditem.DataBind();
               }
 
               var querycompany = (from x in db.SupplierDBs
                                   select x.Company).ToList();
 
               RadComboBox companycombo = (RadComboBox)editedItem.FindControl("CompanyRadComboBox");
 
               foreach (string companyelement in querycompany)
               {
                   RadComboBoxItem selecteditem = new RadComboBoxItem();
                   selecteditem.Text = companyelement.ToString();
                   selecteditem.Attributes.Add("Company", companyelement.ToString());
                   companycombo.Items.Add(selecteditem);
                   selecteditem.DataBind();
               }
 
               var querycountry = (from s in db.CountryCodes
                                   select s.CountryName).ToList();
 
               RadComboBox countrycombo = (RadComboBox)editedItem.FindControl("CountryRadComboBox");
 
               foreach (string countryelement in querycountry)
               {
                   RadComboBoxItem selecteditem = new RadComboBoxItem();
                   selecteditem.Text = countryelement.ToString();
                   selecteditem.Attributes.Add("Country", countryelement.ToString());
                   countrycombo.Items.Add(selecteditem);
                   selecteditem.DataBind();
               }
           }
       }
 
       protected void CurrencyRadComboBox2_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
       {
 
           var querycurrency = (from c in db.CurrencyDBs
                                select c.Currency).ToList();
 
           RadComboBox currencycombo = (RadComboBox)sender;
 
           foreach (string currencyelement in querycurrency)
           {
               RadComboBoxItem selecteditem = new RadComboBoxItem();
               selecteditem.Text = currencyelement.ToString();
               selecteditem.Attributes.Add("Currency", currencyelement.ToString());
               currencycombo.Items.Add(selecteditem);
               selecteditem.DataBind();
           }
       }
 
       protected void CurrencyRadComboBox2_OnSelectedChangedIndex(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
       {
           var querycurrency = (from c in db.CurrencyDBs
                                select c.Currency).ToList();
 
           RadComboBox currencycombo = (RadComboBox)sender;
 
           foreach (string currencyelement in querycurrency)
           {
               RadComboBoxItem selecteditem = new RadComboBoxItem();
               selecteditem.Text = currencyelement.ToString();
               selecteditem.Attributes.Add("Currency", currencyelement.ToString());
               currencycombo.Items.Add(selecteditem);
               selecteditem.DataBind();
           }
       }
 
       protected void EditPORadGrid_UpdateCommand(object sender, GridCommandEventArgs e)
       {
       }

Angel Petrov
Telerik team
 answered on 10 Jul 2013
3 answers
169 views
hi,
i have a radgrid,in which on of my bound column is like this

 <telerik:GridBoundColumn DataField="sInvoiceStatus"  
                    FilterControlAltText="Filter sInvoiceStatus column"  
                    HeaderText="Invoice Status" SortExpression="sInvoiceStatus" 
                    UniqueName="sInvoiceStatus"  >
                      <HeaderStyle Font-Size="Small"   Font-Bold ="true" Wrap ="false"  />
                     <ItemStyle  Width ="150px"  Wrap ="false" />
                                       <FilterTemplate>
                        <telerik:RadComboBox ID="cbInvoiceStatus" DataSourceID="ObjectDataSource2" DataTextField="sInvoiceStatus"  DropDownWidth ="200px"
                            DataValueField="sInvoiceStatus" Height="100px" AppendDataBoundItems="true" Skin="Windows7" SelectedValue='<%# CType(Container, GridItem).OwnerTableView.GetColumn("sInvoiceStatus").CurrentFilterValue %>'
                            runat="server" OnClientSelectedIndexChanged="InvoiceStatusIndexChanged"  OnClientBlur ="Combobox_OnClientBlur"
                OnClientDropDownClosing ="OnClientDropDownClosing" AllowCustomText ="false"  Font-Names ="Arial font" Font-Size ="12px" Filter ="StartsWith" >
                            <Items>
                                <telerik:RadComboBoxItem Text="All" />
                                <telerik:RadComboBoxItem Text="Blank"  value="" />
                               
                            </Items>
                        </telerik:RadComboBox>
                        <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
                            <script type="text/javascript">
                                   function InvoiceStatusIndexChanged(sender, args)
                                    {
                                        var tableView = $find("<%# CType(Container, GridItem).OwnerTableView.ClientID %>");
                                        tableView.filter("sInvoiceStatus", args.get_item().get_value(), "EqualTo");
                                    }
                            </script>
                        </telerik:RadScriptBlock>
                    </FilterTemplate>
                </telerik:GridBoundColumn>

Here i m binding radcombobox with my database for filter purpose.
If i select "All" it filter correctly.
but i also want to select "Blank" in which filter should give me all the values which are '' or NULL in my database.Right now it is giving me only "" value from database...but not NULL values.
I couldnt find the solution.
please help me with this.
Princy
Top achievements
Rank 2
 answered on 10 Jul 2013
1 answer
109 views
Hi Telerik,

I'm having issues with exporting a radgrid that uses a typedlist as datasource. Everything works fine until a sort a column. When a column is sorted and I export the grid to excel i get this error -> System.Data.RowNotInTableException. 
When I use a collection

Stacktrace:

[RowNotInTableException: Deze rij is verwijderd uit een tabel en bevat geen gegevens. Met BeginEdit() kunnen nieuwe gegevens worden gemaakt in deze rij.]
   System.Data.DataRow.GetDefaultRecord() +6224209
   System.Data.DataColumnPropertyDescriptor.GetValue(Object component) +77
   Telerik.Web.UI.GridBoundColumn.OnDataBindColumn(Object sender, EventArgs e) +783
   System.Web.UI.Control.OnDataBinding(EventArgs e) +132
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +170
   System.Web.UI.Control.DataBindChildren() +11058975
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +182
   Telerik.Web.UI.GridItem.SetupItem(Boolean dataBind, Object dataItem, GridColumn[] columns, ControlCollection rows) +756
   Telerik.Web.UI.GridItemBuilder.InitializeItem(Int32 dataSourceIndex, String& nextItemHierarchicalIndex, Boolean& itemIsInEditMode) +192
   Telerik.Web.UI.GridItemBuilder.CreateItems(GridGroupingContext group) +438
   Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +1048
   Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +608
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +72
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +147
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +261
   Telerik.Web.UI.GridTableView.PerformSelect() +23
   Telerik.Web.UI.GridTableView.DataBind() +363
   Telerik.Web.UI.RadGrid.DataBind() +73
   Telerik.Web.UI.RadGrid.AutoDataBind(GridRebindReason rebindReason) +2600
   Telerik.Web.UI.RadGrid.RebindForExport() +119
   Telerik.Web.UI.Grid.Export.TableViewExporter.ExcelExportRenderForm(HtmlTextWriter nullWriter, Control form) +1031
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +115
   System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +411
   System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +87
   System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +53
   Telerik.Web.UI.Grid.Export.TableViewExporter.ExcelExportRenderPage(HtmlTextWriter nullWriter, Control page) +145
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +115
   System.Web.UI.Page.Render(HtmlTextWriter writer) +38
   Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) +647
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +115
   System.Web.UI.Page.Render(HtmlTextWriter writer) +38
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4240

Aspx page:

<script type="text/javascript">
     function onRequestStart(sender, args) {
         if (args.get_eventTarget().indexOf("ExportTo") >= 0) {
             args.set_enableAjax(false);
         }
     }
 </script>
 <telerik:RadAjaxManagerProxy runat="server" ID="RadAjaxManagerProxy">
     <AjaxSettings>
         <telerik:AjaxSetting AjaxControlID="rgPerson">
             <UpdatedControls>
                 <telerik:AjaxUpdatedControl ControlID="rgPerson" LoadingPanelID="RadAjaxLoadingPanel" />
             </UpdatedControls>
         </telerik:AjaxSetting>
     </AjaxSettings>
 </telerik:RadAjaxManagerProxy>
 <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel" runat="server" />
 <telerik:RadGrid ID="rgPerson" GridLines="None" ShowStatusBar="true" AllowPaging="true"
     PageSize="15" Width="100%" AllowSorting="true" runat="server" AutoGenerateColumns="False"
     AllowFilteringByColumn="true" OnNeedDataSource="rgPerson_OnNeedDataSource" OnExcelMLExportRowCreated="rgPerson_OnExcelMLExportRowCreated"
     OnExcelMLExportStylesCreated="rgPerson_OnExcelMLExportStylesCreated">
     <MasterTableView Width="100%" CommandItemDisplay="Top" UseAllDataFields="true" >
         <CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="false" />
         <Columns>
             <telerik:GridBoundColumn DataField="Name" UniqueName="FullName" SortExpression="FullName"
                 CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true"
                 DataType="System.String" />
         </Columns>
     </MasterTableView>
     <ExportSettings ExportOnlyData="true" IgnorePaging="true">
         <Excel Format="ExcelML"></Excel>
     </ExportSettings>
 </telerik:RadGrid>
 <rm:LLBLGenProDataSource ID="dsOrganisationRole" runat="server" DataContainerType="TypedList"
     EnablePaging="True" TypedListTypeName="RisycomLLBL.TypedListClasses.DetailOrganisationRoleTypedList, RisycomLLBL">
 </rm:LLBLGenProDataSource>

In the pagePreRender i do this:

RadAjaxManager.GetCurrent(Page).ClientEvents.OnRequestStart = "onRequestStart"; 

Greetings
Joost





Kostadin
Telerik team
 answered on 10 Jul 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?