Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
235 views

Hello,

I want to show grid header always,even there is no datasource or records,here is the code I tried,but the header did't show:

<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True"  AllowFilteringByColumn="True" CellSpacing="0" ShowHeader="true">
         <MasterTableView AutoGenerateColumns="false" ShowHeader="true" ShowHeadersWhenNoRecords="true">
                        <Columns>
                            <telerik:GridBoundColumn DataField="BrandName" HeaderText="Brand Name" UniqueName="BrandName">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Model" HeaderText="Model" UniqueName="Model">
                            </telerik:GridBoundColumn>
                            </Columns>
             </MasterTableView>
         </telerik:RadGrid>

 

what should I do?

Pavlina
Telerik team
 answered on 15 Jun 2016
1 answer
238 views

Hi,
I’m trying to export a radgrid using this code:

RadGrid1.ExportSettings.Word.Format = Telerik.Web.UI.GridWordExportFormat.Docx;
RadGrid1.ExportSettings.UseItemStyles = true;
RadGrid1.MasterTableView.ExportToWord();


This works but I’m trying to do the following unsuccessfully

1. Make the word file landscape mode
2. Add a header and footer

Please can you clarify how to accomplish these things please?

Kostadin
Telerik team
 answered on 15 Jun 2016
4 answers
211 views

Hi,

The "Apply CSS class" dropdown won't load if the css file uses Google fonts Eg.:

@import url(https://fonts.googleapis.com/css?family=Alegreya+Sans:400,100,300,500,700,800,900,900italic,800italic,700italic,500italic,400italic,300italic,100italic|Open+Sans:400,400italic);

Anything we can do about this?

Marc

 ​

Joana
Telerik team
 answered on 15 Jun 2016
3 answers
413 views

Hi,

I am trying to add tabs, pageviews dynamically, and then iframes  in the pageviews.  However, on postback, the iframes are not persisted.

 

 

HtmlGenericControl iframe = new HtmlGenericControl("iframeA");

 

PageView pageView = new PageView();


pageView.Controls.Add(iframe);
multiPage.PageViews.Add(pageView);

However, if i statically do it (as below), the iframes are persisted.  Can you please show me a way to make this work.

Thanks,
Raj

 

 

<telerik:RadPageView id="Pageview2" runat="server" >
                                <iframe  id="ContentIframe2" width=100% height="600px" frameborder="0" scrolling="auto" runat="server"></iframe>
                            </telerik:RadPageView> 
                            <telerik:RadPageView id="Pageview3" runat="server" >
                                <iframe  id="ContentIframe3" width=100% height="600px" frameborder="0" scrolling="auto" runat="server"></iframe>
                            </telerik:RadPageView> 
                            <telerik:RadPageView id="Pageview4" runat="server" >
                                <iframe  id="ContentIframe4" width=100% height="600px" frameborder="0" scrolling="auto" runat="server"></iframe>
                            </telerik:RadPageView> 
                            <telerik:RadPageView id="Pageview5" runat="server" >
                                <iframe  id="ContentIframe5" width=100% height="600px" frameborder="0" scrolling="auto" runat="server"></iframe>
                            </telerik:RadPageView> 

Patrick
Top achievements
Rank 1
 answered on 15 Jun 2016
9 answers
504 views

Hi,

I need to place an "X" in all cells that have a true value in the export.  I've seen similar posts, but I am using Format="Xlsx" and trying to accomplish this task using the OnInfrastructureExporting event handler as follows:

protected void grdUserAdmin_InfrastructureExporting(object sender, GridInfrastructureExportingEventArgs e)
{
    var colCount = e.ExportStructure.Tables[0].Columns.Count;
    var rowCount = e.ExportStructure.Tables[0].Rows.Count;
    ExportStyle headerStyle = new ExportStyle();
    headerStyle.ForeColor = Color.White;
    headerStyle.BackColor = Color.Blue;
    headerStyle.Font.Bold = true;
 
    // Set the header style for all columns
    for (var i = 1; i <= colCount; i++)
    {
        e.ExportStructure.Tables[0].Cells[i, 1].Style = headerStyle;
        e.ExportStructure.Tables[0].Columns[i].Width = 200; // Would like auto-width !!
    }
 
    // Place an "X" in cells assigned to a boolean data field if value is true
    var headerText = "";
    for (var c = 1; c <= colCount; c++)
    {
        for (var r = 1; r <= rowCount; r++)
        {
            if (r == 1)
            {
                headerText = e.ExportStructure.Tables[0].Cells[c, r].Value.ToString();
                continue;
            }
            if (headerText == "Active")
            {
                var x = e.ExportStructure.Tables[0].Cells[c, r].Value.ToString();
                System.Diagnostics.Debug.WriteLine("Cell Value: " + x);
                if (Convert.ToBoolean(e.ExportStructure.Tables[0].Cells[c, r].Value.ToString()))
                    e.ExportStructure.Tables[0].Cells[c, r].Value = "X";
            }
        }
    }
 
}

The value for the variable x above is always "" or null (hard to tell in the Output section of VS).
I know that my data for column Active should have all true values.
The conversion to boolean fails!
I think I'm close.
What am I doing wrong?
Thanks in advance for any advice.
Jim

jlj30
Top achievements
Rank 2
 answered on 14 Jun 2016
11 answers
876 views
I have a RadGrid that uses an EditForm template in order to lay the controls out according to the wishes of the customer. I have not been able to get the RadTextBox within the template to receive focus when it goes into edit mode.
<telerik:RadGrid ID="rgComments" runat="server" AutoGenerateColumns="False" Width="100%" AllowSorting="True" CellSpacing="0" GridLines="None" Height="455px">
  <MasterTableView CommandItemDisplay="Top" CommandItemSettings-AddNewRecordText="Add Comment" CommandItemSettings-ShowRefreshButton="true" TableLayout="Fixed" EditMode="EditForms" DataKeyNames="iNoteID,qwImageID">
    <EditFormSettings EditFormType="Template">
      <FormTemplate>
        <div style="position: relative; height: 215px; width: 800px;">
          <telerik:RadTextBox ID="rtbComment" runat="server" Width="795px" Height="165px" ClientEvents-OnLoad="taComment_onload" />
          <asp:ImageButton ID="ibSave" runat="server" ImageUrl="~/Images/Save.png" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' style="position: absolute; left: 10px; top: 180px;" />
          <asp:ImageButton ID="ibCancel" runat="server" ImageUrl="~/Images/Cancel.png" CommandName="Cancel" style="position: absolute; left: 70px; top: 180px;" />
        </div>
      </FormTemplate>
    </EditFormSettings>
    <Columns>
      <telerik:GridEditCommandColumn ButtonType="ImageButton" HeaderStyle-Width="30px" ItemStyle-HorizontalAlign="Center" EditImageUrl="~/Images/Edit.png" UniqueName="gecEdit" />
      <telerik:GridBoundColumn DataField="dtCreateDate" HeaderText="Create Date" HeaderStyle-Width="66" HeaderStyle-HorizontalAlign="Center" DataFormatString="{0:MM/dd/yyyy HH:mm}" ReadOnly="True" UniqueName="gbc_dtCreateDate" />
      <telerik:GridBoundColumn DataField="cLoginName" HeaderText="Create By" HeaderStyle-Width="66" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ReadOnly="True" UniqueName="gbc_cLoginName" />
      <telerik:GridBoundColumn DataField="cNote" HeaderText="Comment" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="500px" MaxLength="1024" UniqueName="gbc_cNote" />
      <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" HeaderStyle-Width="30px" ItemStyle-HorizontalAlign="Center" ImageUrl="~/Images/Delete.png" UniqueName="bcDelete" />
    </Columns>
  </MasterTableView>
  <ClientSettings><Scrolling AllowScroll="true" /></ClientSettings>
</telerik:RadGrid>

When the form goes into edit mode I want to put the current Comment text into the RadTextBox and set focus there. I am using this code to try and do that.
void rgComments_ItemDataBound(object sender, GridItemEventArgs e)
{
  if (e.Item.IsInEditMode && e.Item is GridEditableItem)
  {
    GridEditableItem item = e.Item as GridEditableItem;
    RadTextBox radTextBox = ((RadTextBox)(((GridEditFormItem)(item)).FindControl("rtbComment")));
   
    // It works if I comment out this line, but then control is not populated with the necessary text
    radTextBox.Text = ((DataRowView)(((GridItem)(item)).DataItem)).Row["cNote"].ToString();
   
    radTextBox.Focus();
  }
}

I have tried adding a client-side onload event handler for the control to set the focus. It gets called but still won't put focus into the control.

Can you help me figure this out?

John
jlj30
Top achievements
Rank 2
 answered on 14 Jun 2016
7 answers
471 views
Is there a way to get the headertext to be visible in the header of a GridClientSelectColumn?
I have a customer who insists that "nobody is going to know what it does" if there isn't any text in the header...
Eyup
Telerik team
 answered on 14 Jun 2016
1 answer
165 views
I had setup a way to restore the filtering/sorting of the grid through session on page load when it went to "NeedDataSource" function. However, the data I am currently populating has a lot of data, and had to optimize the performance of the grid by starting to use the entitydatasource that you specified in the documentation. The grid is faster, but I am unsure how to restore the filter/sort settings the user made now. Is there another way I can restore?
Viktor Tachev
Telerik team
 answered on 14 Jun 2016
1 answer
223 views

Dear Friends,

I am preparing dynamic grid using VB.net and RAD grid where columns are getting generated in Run Time. I am trying to apply filter (inbuilt filter) on multiple column at time but application is throwing exception (is neither a DataColumn nor a DataRelation for table Table). This error occurs when I try to apply filter. I am unable to identify root cause. Any input would be appreciated. I am using NeedDataSource() event of Radgrid and this event is throwing above mentioned exception on applying filter.

Thanks in advance.
Lokesh

Viktor Tachev
Telerik team
 answered on 14 Jun 2016
1 answer
172 views

I know I have done this before, but I can't remember how....don't you hate being in that situation?!?

I want a simple nested table, of say customers and their orders, displayed in a fashion where customers are the master table, and orders are the detail table.  In other words, the grid shows a list of customers and you can expand a customer to see their orders.  I can easily get the data in a datatable where the customer data is duplicated on each row which represents a unique order.  I want to setup the grid so that I can do one bind and have it all populated.  All of the examples now show a separate databind for each of the child(nested) tables.  For efficiency and simplicity, I'd like to avoid all of the extra databinds.  I know I've done this in the past...

Any help or examples would be greatly appreciated.

Thanks in advance,

Pavlina
Telerik team
 answered on 14 Jun 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?