Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
94 views
hi,
 
i have a RadGrid showing some data and i'm using a formtemplate, a user can edit any item to view it's contents is there any way to print the edited item only ?


thanks
Eyup
Telerik team
 answered on 02 Oct 2014
1 answer
1.8K+ views
I can do this in a normal asp grid but I do not know how to achieve the same with radgrid.

In a asp grid I add nested grids like this:

<asp:TemplateField>
    <ItemTemplate>
        <asp:GridView ID="secondLevelGrid"  runat="server" AutoGenerateColumns="false" CssClass="ChildGrid" OnRowDataBound="secondLevelGrid_OnRowDataBound">
                    <Columns>
 
                        <%--My new nested  grid goes here--%>
 
                        <asp:BoundField DataField="Id" HeaderText="Id" />
                        <asp:BoundField DataField="Code" HeaderText="Code" />
                        <asp:BoundField DataField="Quantity" HeaderText="Q.ty" />
                        </Columns>
            </asp:GridView>
    </ItemTemplate>
</asp:TemplateField>

How do I make the above in a radgrid considering that I have 7 level nested grids?

protected void firstLevelGrid_OnRowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        GridView firstLevelGrid = e.Row.NamingContainer as GridView;
        string code = firstLevelGrid.DataKeys[e.Row.RowIndex].Value.ToString();
        GridView secondLevelGridView = e.Row.FindControl("secondLevelGrid") as GridView;
        secondLevelGridView.DataSource = //GetData
        secondLevelGridView.DataBind();
    }
}
How do I make the equivalent of the OnRowDataBound for each nested grid in RadGrid?

Thanks for helping. If someone could please show me how to achieve the above in RadGrid then I will add the additional six level nesting I need. Thanks
Pavlina
Telerik team
 answered on 02 Oct 2014
3 answers
104 views
Hello,
I'm trying to implement the use of a GridBinaryImageColumn + GridBinaryImageColumnEditor to automatically manage the upload of an image into a RadGrid-
Data comes from custom classes, images come from a blob field in db and are rendered properly in grid; however, when I edit the record and try to upload a new image, my  GridBinaryImageColumnEditor always tells it cannot find any uploaded file.

My grid:

<telerik:RadGrid ID="grdLinee" runat="server" AutoGenerateColumns="false" AllowAutomaticUpdates="false" AllowSorting="true" AllowPaging="true" PageSize="10"
                OnNeedDataSource="grdLinee_NeedDataSource" AllowAutomaticInserts="true" AllowAutomaticDeletes="false" OnItemCommand="grdLinee_ItemCommand" OnSelectedIndexChanged="grdLinee_SelectedIndexChanged"
                AllowFilteringByColumn="false" MasterTableView-EditMode="InPlace" ShowHeader="true" ShowFooter="true" ShowStatusBar="true" Skin="Office2007">
                 <PagerStyle Mode="NextPrevAndNumeric" />
                <ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true">
                    <Selecting AllowRowSelect="true" />
                </ClientSettings>
                <MasterTableView DataKeyNames="idCatalogoLinee" CommandItemDisplay="Top">
                    <Columns>
                        <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"></telerik:GridEditCommandColumn>
                        <telerik:GridButtonColumn Text="Delete" CommandName="Delete" ButtonType="ImageButton" ConfirmText="Sei sicuro?" />
                        <telerik:GridBinaryImageColumn DataField="immagine" UniqueName="immagine" ResizeMode="Fit" DataType="System.Byte"></telerik:GridBinaryImageColumn>
//...

Code:

protected void grdLinee_ItemCommand(object sender, GridCommandEventArgs e)
        {
 switch(e.CommandName)
{
   case "Update":
 GridBinaryImageColumnEditor editor = (GridBinaryImageColumnEditor)item.EditManager.GetColumnEditor("immagine");
//editor.RadUploadControl.UploadedFiles.Count here is always 0
//...
}
}


I don't get any error in itemcommand, but always get 0 files   (and editor.UploadedFileContent.Length=0). The same update command is working properly with other database fields, which I can update: what am I missing to properly handle file upload?
Thanks for any hint,
al.

Maria Ilieva
Telerik team
 answered on 02 Oct 2014
3 answers
161 views
I am quite lost with this.
I have a radgrid that has auto generated columns. The user selects an item from a drop down list and the grid load the selected table.
The tables have all the same DB structure: Id-Code-Description-Bla....Bla-Sub.
If the filed "Sub" contains the value "yes" means that the Code has is own table and is not a  single item. So there are rows representing single items and rows  representing another table.

<telerik:RadGrid ID="RadGrid1" runat="server" Culture="it-IT" AllowPaging="True" AllowSorting="True" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True">
                <ExportSettings ExportOnlyData="True">
                    <Pdf PageWidth="">
                    </Pdf>
                </ExportSettings>
                <ClientSettings>
                    <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                </ClientSettings>
                <MasterTableView CommandItemDisplay="Top" DataKeyNames="Code" InsertItemPageIndexAction="ShowItemOnCurrentPage">
                    <CommandItemSettings ShowExportToExcelButton="True" />
                    <Columns>
                        <telerik:GridEditCommandColumn ButtonType="ImageButton">
                            <HeaderStyle Width="30px" />
                        </telerik:GridEditCommandColumn>
                        <telerik:GridButtonColumn ButtonType="ImageButton" Text="Delete" CommandName="Delete" FilterControlAltText="Filter column1 column" ConfirmDialogType="RadWindow" ConfirmText="Do you really want to delete this project and all its content?" UniqueName="Cancel">
                            <HeaderStyle Width="30px" />
                        </telerik:GridButtonColumn>
                    </Columns>
 
                    <EditFormSettings>
                        <EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>
                    </EditFormSettings>
                    <PagerStyle AlwaysVisible="True" />
                </MasterTableView>
                <PagerStyle AlwaysVisible="True" />
            </telerik:RadGrid>

How can I auto generate the nested grid if the filed value of "Sub" in any row  is "yes"?
Thanks for supporting,
Felice
Pavlina
Telerik team
 answered on 02 Oct 2014
3 answers
450 views
I am trying to restrict users entering Regular Expression value like  <%^>/   in RadComboBox while typing  but it throws error message "Object doesn't support this property or method" 

I want to validate it while typing in RadComboBox.

function OnClientKeyPressing(sender, args) {
if(checkRegEx())      // checking the RegEx value, if pass then proceed else remove the last character entered  
                    {
// Proceed.......
}
else
{
args.set_cancel(true);  // ERROR : Object doesn't support this property or method 

}                
            }




<telerik:RadComboBox ID="rcbMonthEndDate" Runat="server" TabIndex="5"
DropDownWidth="100px" MarkFirstMatch="true" AllowCustomText="true" EnableLoadOnDemand="false"
   HighlightTemplatedItems="true" OnClientKeyPressing="OnClientKeyPressing" 
   NoWrap="true" EmptyMessage="Select Date" AutoPostBack="False"
   Enabled="true" Width="100px"    
   DataTextField="MonthEndDate" DataTextFormatString="{0:yyyy-MM-dd}" 
   DataValueField="MonthEndDate">
   <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "MonthEndDate", "{0:yyyy-MM-dd}")%>
                                </ItemTemplate>
<ExpandAnimation Type="OutBounce" />
<CollapseAnimation Type="InBack" />                            
  </telerik:RadComboBox>



Nencho
Telerik team
 answered on 02 Oct 2014
3 answers
264 views
Hi,

I've created a custom skin and embed all resource in an assembly.
All is loaded properly in the aspx page.
In my solution, I only reference Telerik.Web.UI and CustomSkin assemblies, I did not reference Telerik.Web.UI.Skins.

When debugging the aspx page in IE through F12,..

I saw that for ImageGallery's Next Button for example,..

background-image: none
   .RadImageGallery : none
   .RadImageGallery : url('/xxx/xxx/WebResource.axd?d=xxxxx&t=xxxx')    <== this is striked-out

The first .RadImageGallery (none value) is coming from Telerik.Web.UI assembly (Telerik.Web.UI.Skins.ImageGallery.css)

The second .RadImageGallery (WebResource.axd value) is coming from the CustomSkin assembly, but is overridden by the first .RadImageGallery from Telerik.Web.UI assembly

As such, the image of the Next button is not shown.

Question is, if I have a ASP.NET Theme with a Skin File of :

<telerik:RadImageGallery runat="server" EnableEmbeddedSkins="false" Skin="TelerikRadControl" RenderMode="Lightweight" />


why is Telerik.Web.UI.Skins.ImageGallery.css still being loaded / part of the css ?

shouldn't the CustomSkin assembly be the only one loaded into the page?

Thanks,
Henry


Galin
Telerik team
 answered on 02 Oct 2014
2 answers
108 views
Hi,
I have a grid and its editformtemplate there is another grid. this inner grid maked inplace edits. I make manual update commands on inner grid to decide if I should update database or not. if I fond a problem and decide not to update database I set e.Canceled = True and want to show a warning label which is named lblneedTofindThisLabel below. Warning label is outside of inner gird, inside of formtemplate of outer grid. how can I find this control from inner grid's update command event ?

in other words:
    RadGridCompanies
        editformtemplate
            label
            InnerGrid (inplace edit)
                    Updateevent
                            -- must find label here.


<telerik:RadGrid ID="RadGridCompanies" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSourceCompanies"
             GridLines="None" AllowAutomaticDeletes="false" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
             AllowPaging="True" AllowSorting="True" CellSpacing="0" Width="900px" Skin="Web20" PageSize="20">
             <GroupingSettings CaseSensitive="false" />
 
             <ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true" EnableRowHoverStyle="True">
                 <Selecting AllowRowSelect="true" />
                 <Selecting AllowRowSelect="True"></Selecting>
             </ClientSettings>
 
 
             <MasterTableView DataKeyNames="ID, guidid" DataSourceID="SqlDataSourceCompanies" CommandItemDisplay="Top"
                 EditMode="PopUp">
                 <CommandItemSettings ExportToPdfText="Export to PDF"
                     ShowRefreshButton="False"></CommandItemSettings>
                 <RowIndicatorColumn>
                     <HeaderStyle Width="20px"></HeaderStyle>
                 </RowIndicatorColumn>
                 <ExpandCollapseColumn>
                     <HeaderStyle Width="20px"></HeaderStyle>
                 </ExpandCollapseColumn>
 
                 <Columns>
                     <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" HeaderText="ID" ReadOnly="True" SortExpression="ID" UniqueName="ID" Visible="false">
                         <ColumnValidationSettings>
                             <ModelErrorMessage Text=""></ModelErrorMessage>
                         </ColumnValidationSettings>
                     </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn DataField="guidid" HeaderText="guidid" ReadOnly="True" SortExpression="guidid" UniqueName="guidid" Visible="false">
                         <ColumnValidationSettings>
                             <ModelErrorMessage Text=""></ModelErrorMessage>
                         </ColumnValidationSettings>
                     </telerik:GridBoundColumn>
                     
                    .... other columns..
 
                  <EditFormSettings EditFormType="Template" PopUpSettings-Width="950px" PopUpSettings-Height="650px">
                               <EditColumn UniqueName="EditCommandColumn1">
                               </EditColumn>
                               <FormTemplate>
                                  
                                  
                                  <telerik:RadGrid ID="RadGridMids" runat="server" AllowAutomaticUpdates="false" OnUpdateCommand="RadGridMids_UpdateCommand"
                                             DataSourceID="SqlDataSourceMids" GridLines="None" Skin="Web20" AutoGenerateColumns="False" CellSpacing="0" Width="800px">
                                             <ClientSettings EnableRowHoverStyle="True">
                                             </ClientSettings>
                                             <MasterTableView DataKeyNames="ID" DataSourceID="SqlDataSourceMids" EditMode="InPlace" CommandItemDisplay="Top">
                                                 <Columns>
                                                     <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" HeaderText="ID" ReadOnly="True" UniqueName="ID" Visible="false"></telerik:GridBoundColumn>
 
                                                     <telerik:GridTemplateColumn DataField="Bank" FilterControlAltText="Filter BankName column" HeaderText="Bank" SortExpression="Bank" UniqueName="Bank">
                                                         <EditItemTemplate>
                                                             <asp:TextBox ID="BankTextBox" runat="server" Text='<%# Bind("Bank") %>'></asp:TextBox>
                                                         </EditItemTemplate>
                                                         <ItemTemplate>
                                                             <asp:Label ID="BankLabel" runat="server" Text='<%# Eval("Bank") %>'></asp:Label>
                                                         </ItemTemplate>
                                                          
                                                         ... other columns...
                                                          
                                                     </telerik:GridTemplateColumn>
                                                            <telerik:GridEditCommandColumn>
                                                     </telerik:GridEditCommandColumn>
                                                 </Columns>
                                                 <EditFormSettings>
                                                     <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
                                                 </EditFormSettings>
                                             </MasterTableView>
                                             <FilterMenu EnableTheming="True">
                                                 <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                                             </FilterMenu>
                                 </telerik:RadGrid>
                                          
                                <asp:Label ID="lblneedTofindThisLabel" runat="server" Text="label to find" Visible="false" ></asp:Label>
                                                             
                     </FormTemplate>
                     <PopUpSettings Modal="True" Width="1000px" />
                 </EditFormSettings>
 
             </MasterTableView>
             <FilterMenu EnableImageSprites="False">
             </FilterMenu>
         </telerik:RadGrid>

and the code is :

Protected Sub RadGridMids_UpdateCommand(sender As Object, e As GridCommandEventArgs)
 
      Dim editedItem As GridEditableItem = TryCast(e.Item, GridEditableItem)
      Dim ID_ As String = editedItem.OwnerTableView.DataKeyValues(editedItem.ItemIndex)("ID").ToString()
       
     ' .... some logic....
       
     ' -- WHAT X should be. ?
       
      Dim lblneedTofindThisLabel As Label = (TryCast(x.FindControl("lblneedTofindThisLabel"), Label))
       
      lblneedTofindThisLabel.visible=true
         end sub
Eyup
Telerik team
 answered on 02 Oct 2014
1 answer
117 views
I am unable to get sorting  to work for this grid as well as to control the size of the filter text boxes for this grid.
I think the problem is associated with the way I select the datasource but I do not know how to fix it and I need to allow selecting the Sql table to the user.

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DropDownList1.DataSource = SqlDataSource2;
            DropDownList1.DataBind();
        }
        SetDataSource();
    }
 
    protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e)
    {
        if (DropDownList1.SelectedIndex > 0)
        {
            SetDataSource();
            RadGrid1.Rebind();
        }
    }
 
    private void SetDataSource()
    {
        if (DropDownList1.SelectedIndex > 0)
        {
            string tableInUse = DropDownList1.SelectedItem.Text;
            RadGrid1.DataSource = SqlDataSource1;
            SqlDataSource1.DeleteCommand = "DELETE FROM [" + tableInUse + "] WHERE [Id] = @Id";
            SqlDataSource1.InsertCommand = "INSERT INTO [" + tableInUse + "] ([Code], [Description], [Bkgroup], [Stgroup], [Quantity], [BomNote], [UnitEng], [AlternCost]) VALUES (@Code, @Description, @Bkgroup, @Stgroup, @Quantity, @BomNote, @UnitEng, @AlternCost)";
           SqlDataSource1.SelectCommand = "SELECT prod.Id, prod.Code, prod.Description, prod.Bkgroup, prod.Stgroup, prod.Quantity," +
                                           "prod.BomNote, prod.UnitEng, prod.AlternCost, comp.Unit, comp.Cost, comp.NoteComp " +
                                           "FROM  " + tableInUse + " prod " +
                                           "left JOIN  Components comp ON  comp.Code = prod.Code";
            SqlDataSource1.UpdateCommand = "UPDATE [" + tableInUse + "] SET [Code] = @Code, [Description] = @Description, [Bkgroup] = @Bkgroup, [Stgroup] = @Stgroup, [Quantity] = @Quantity, [BomNote] = @BomNote, [UnitEng] = @UnitEng, [AlternCost] = @AlternCost WHERE [Id] = @Id";
        }
    }
 
    protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        RadGrid1.DataSource = SqlDataSource1;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        RadGrid1.MasterTableView.TableLayout = GridTableLayout.Auto;
        RadGrid1.AllowFilteringByColumn = true;
        RadGrid1.MasterTableView.AllowFilteringByColumn = true;
        RadGrid1.Rebind();
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        RadGrid1.MasterTableView.TableLayout = GridTableLayout.Auto;
        RadGrid1.AllowFilteringByColumn = false;
        RadGrid1.MasterTableView.AllowFilteringByColumn = false;
        RadGrid1.Rebind();
    }
      protected void RadGrid1_ItemCreated1(object sender, GridItemEventArgs e)
       {
       if (e.Item is GridFilteringItem)
        {
            GridFilteringItem filteringItem = e.Item as GridFilteringItem;
            //set dimensions for the filter textbox  
            TextBox box = filteringItem["Code"].Controls[0] as TextBox;
            box.Width = Unit.Pixel(30);
        }
    }

If I try to use the Item_created event to control the size of the filter text boxes, I get a null reference exception.

<div>
           <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" AppendDataBoundItems="true" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged1" DataTextField="Name" DataValueField="Name">
               <asp:ListItem Text="-Select a BOM" />
           </asp:DropDownList>
           <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:BOMConnectionString %>" SelectCommand="SELECT [Name] FROM [IndexTabb]"></asp:SqlDataSource>
           <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Filter On" />
           <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Filter Off" />
           <br />
           <br />
           <br />
           <telerik:RadGrid ID="RadGrid1" runat="server" Culture="it-IT" AllowPaging="True" AllowSorting="True" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCreated="RadGrid1_ItemCreated1">
               <ExportSettings ExportOnlyData="True">
                   <Pdf PageWidth="">
                   </Pdf>
               </ExportSettings>
               <ClientSettings>
                   <Scrolling AllowScroll="True" UseStaticHeaders="True" />
               </ClientSettings>
               <MasterTableView CommandItemDisplay="Top" DataKeyNames="Code" InsertItemPageIndexAction="ShowItemOnCurrentPage" AllowNaturalSort="False">
                   <CommandItemSettings ShowExportToExcelButton="True" />
                   <Columns>
                       <telerik:GridEditCommandColumn ButtonType="ImageButton">
                           <HeaderStyle Width="30px" />
                       </telerik:GridEditCommandColumn>
                       <telerik:GridButtonColumn ButtonType="ImageButton" Text="Delete" CommandName="Delete" FilterControlAltText="Filter column1 column" ConfirmDialogType="RadWindow" ConfirmText="Do you really want to delete this project and all its content?" UniqueName="Cancel">
                           <HeaderStyle Width="30px" />
                       </telerik:GridButtonColumn>
                   </Columns>
                   <EditFormSettings>
                       <EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>
                   </EditFormSettings>
                   <PagerStyle AlwaysVisible="True" />
               </MasterTableView>
               <PagerStyle AlwaysVisible="True" />
           </telerik:RadGrid>
           <br />
           <br />
       </div>
       <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:BOMConnectionString %>">
       </asp:SqlDataSource>
And sorting is not working. When I click on the header of the column I can see the small arrow changing up or down but nothing happens.
How can I get control of the filter text boxes size and make the sorting working in this context?
Any help will be appreciated.
Eyup
Telerik team
 answered on 02 Oct 2014
1 answer
133 views
Needing to do a gantt chart based on fy and quarters.
Any suggestions.
Bozhidar
Telerik team
 answered on 02 Oct 2014
1 answer
132 views
hi

This my code:
  
<telerik:RadTextBox ID="RadTextBox1" Runat="server" Resize="None" Rows="1" TextMode="MultiLine" Width="160px"> </telerik:RadTextBox>

As you can see, the Rows attribute is set to 1, which means it should display as 1 row in the browser. But it is not getting it right in FF 32.0. It works fine in IE 11 and chrome.

How do i solves this? Thanks a lot.
Eyup
Telerik team
 answered on 02 Oct 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?