Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
131 views

how do i create a Dynamic DataTable for RadGrid.

I just follow the same procedure for GridView

DataTable myDataTable = new DataTable();

 

 

 

DataColumn myDataColumn;

 

myDataColumn =

 

new DataColumn();

 

myDataColumn.DataType =

 

Type.GetType("System.String");

 

myDataColumn.ColumnName =

 

"ID";

 

myDataTable.Columns.Add(myDataColumn);

myDataColumn =

 

new DataColumn();

 

myDataColumn.DataType =

 

Type.GetType("System.String");

 

myDataColumn.ColumnName =

 

"TestName";

 

myDataTable.Columns.Add(myDataColumn);

myDataColumn =

 

new DataColumn();

 

myDataColumn.DataType =

 

Type.GetType("System.String");

 

myDataColumn.ColumnName =

 

"ReportResults";

 

myDataTable.Columns.Add(myDataColumn);

myDataColumn =

 

new DataColumn();

 

myDataColumn.DataType =

 

Type.GetType("System.String");

 

myDataColumn.ColumnName =

 

"CommunicationType";

 

myDataTable.Columns.Add(myDataColumn);

 

 

//add test row

 

 

 

 

 

 

 

DataRow drow = myDataTable.NewRow();

 

drow[

 

"ID"] = Guid.NewGuid().ToString();

 

drow[

 

"TestName"] = "TestName1";

 

drow[

 

"ReportResults"] = "ReportName1";

 

drow[

 

"CommunicationType"] = "CommunicationType1";

 

 

 

//Add the row to the datatable.

 

 

 

 

 

myDataTable.Rows.Add(drow);

this datatable is working fine for GridView.
But when i binding for RADGRID, it showing some error like
"

Name is neither a DataColumn nor a DataRelation for table .

"
Any help will be highly appriceated.

Regards,
Suresh Kumar Udatha.

Tsvetoslav
Telerik team
 answered on 13 May 2010
1 answer
80 views

Hi 

I need to get the grid item value thru javascript. The below code is working fine in IE.

 

 

var maxRowIndex = this.ncRadGrid.Grid.get_masterTableView().get_dataItems().length - 1;

 

 

var rowIndex;

 

 

 

for (rowIndex = 0; rowIndex <= maxRowIndex; rowIndex++) {

 

 

 

var nodeID = this.ncRadGrid.GetValue(rowIndex, 'NodeID')
}

 


Please provide the solution for this.

Priya .B
Pavlina
Telerik team
 answered on 13 May 2010
3 answers
191 views
I have an Edit FormTemplate in my Grid that is bound to an OleDb dataset (Access).  On submission of the edit form, control goes to my OnItemCommand routine.  The statement:

GridEditableItem grdSelected = (GridEditableItem)e.Item;
Results in the error:
{"The current EditFormType does not support the requested editing capabilities."}

and I am unable to retrieve the form's data values from their controls.
This same code works fine with a SQL dataset.  Here is my OleDb code that populates the grid:

 

OleDbConnection accConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=//webservice/C$/temp/fcData.mdb");  
OleDbCommand accCommand = new OleDbCommand("select mmw_drug_disp.descdisplay,strength,strengthunit,ddid,dosechekunit, strength+' '+strengthunit as dispdose, mmw_drug_name.descdisplay as drugname, "  
   + "'' as freq, '' as route, '' as comments, null as startdate, null as stopdate, null as dcdate, '' as therapy "  
   + "from mmw_drug_disp "  
   + "inner join mmw_drug_name on  mmw_drug_disp.pnid = mmw_drug_name.pnid "  
   + "where mmw_drug_disp.haspackdrugind=1 and mmw_drug_disp.descsearch like '" + searchtext + "%' order by mmw_drug_disp.descdisplay", accConn);  
OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(accCommand);  
accConn.Open();  
DataSet myDataSet = new DataSet();  
myDataAdapter.Fill(myDataSet, "Names");  
 
RadGrid1.DataSource = myDataSet;  
RadGrid1.DataMember = "Names";  
this.DataBind(); 
Thanks for asny suggestions.  Dan

Mira
Telerik team
 answered on 13 May 2010
2 answers
143 views

I am trying to figure out how to apply a custom skin to my radupload control (and progressarea for that matter)

All the examples found on the site refer to a folder I don't have when I install the controls. Additionally it appears that all the skins I can find are actually embedded in the .dll.and not taken from the files.

How do I refer to a skin that is not embedded? It is related to the EnableEmbeddedSkins property, and if so how to refer to the skin path?

Hope you can help me, a simple example should do the trick.

Best Regard

Nikolaj
Basel Nimer
Top achievements
Rank 2
 answered on 13 May 2010
1 answer
104 views

We are dealing with major performance issues on our website and I started to diagnise the issue.

For testing, I took simple web page with telerik grid that has one column and one row. After saving this page physically on my hard disk I noticed that there are 32 .axd files saved which are about 1.02mb in size. 17 of them are ScriptResource.axd and 15 of them are WebResource.axd.

We are trying to fine tune our application for 256kbps download speed, which means it will take about 4-5 seconds to launch telerik web page grid with one column and one row (4-5 sec download time to downloan 1mb over 256kbps speed). That’s what we are seeing in all pages, launch times are between 5-9 seconds. Can I do some tweak to telerik code to bring down launch time to 1 second by reducing total .axd file size to 256kb? OR is it that telerik controls are not suitable for 256kbps internet speed??

Question

1) Can I move any of these .axd files to client PC on first instance?

2) Can I reduce .axd file size?

3) Can I reduce number of .axd files downloaded to client PC?

PLEASE HELP.

Fiko
Telerik team
 answered on 13 May 2010
1 answer
127 views
My radGrid displays data from a SQL Server 2008 data source. Because the information is proprietary I have have had to blot out any real information but I have left what is needed to show you the issue I am seeing.

When the radGrid is populated everything works great. Data lines up properly in all columns, when you hover on the link a radTooltip popup out displaying information.

But when you sort on any column, the columns stop lining up because it looks like "word wrapping" gets turned off. So instead of one of our Agency names wrapping and displaying on two lines in the grid column it is shown on one line. This would be fine if I could get this to be consistent for all columns and column headers. The agency name is pushed into the next 2 columns data so that data is pushed over as well.

I have attached two screenshots showing what I am talking about. As you can see in the Before.png, everything looks and works fine including the tooltip. After sorting, the Agent Name column spans well into the 3rd column over, SCAC. Also, strangely after sorting my tooltip ceases working.

How do I get my columns to stay lined up and can anyone answer why the tooltip breaks when the data is sorted?

search.ascx
<telerik:RadAjaxManager ID="radAM" runat="server"> 
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="radRadiusSearch"> 
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="radRadiusSearch" LoadingPanelID="radALP" /> 
                <telerik:AjaxUpdatedControl ControlID="radTTM" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
    </AjaxSettings> 
</telerik:RadAjaxManager> 
<telerik:RadAjaxLoadingPanel ID="radALP" runat="server"></telerik:RadAjaxLoadingPanel> 
<telerik:RadToolTipManager ID="radTTM" runat="server" OffsetY="-1" HideEvent="LeaveToolTip" 
 Width="300" Height="75" OnAjaxUpdate="OnAjaxUpdate" RelativeTo="Element" Position="BottomRight" Skin="Windows7"> 
 </telerik:RadToolTipManager> 
 
<telerik:RadGrid ID="radRadiusSearch" runat="server"  
    AllowSorting="True" AllowPaging="True"   
    width="950px" AutoGenerateColumns="False"     
     Skin="Windows7"  
    EnableViewState="False" Visible="False"> 
    <MasterTableView Width="950px" AllowMultiColumnSorting="true" DataKeyNames="AgentNumber" CommandItemDisplay="None" CurrentResetPageIndexAction="SetPageIndexToFirst" Dir="LTR" Frame ="Border" TableLayout="Auto"> 
        <Columns> 
            <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="AgentNumber" Display="false" 
                DataType="System.String" FilterListOptions="VaryByDataType" ForceExtractValue="None" 
                HeaderText="Agent #" ReadOnly="True" SortExpression="AgentNumber" UniqueName="AgentNumber"> 
            </telerik:GridBoundColumn>                               
            <telerik:GridTemplateColumn HeaderText="Agent #" SortExpression="AgentNumber"> 
                <ItemTemplate> 
                    <asp:HyperLink ID="targetControl" runat="server" NavigateUrl="#" Text='<%# Eval("AgentNumber") %>'></asp:HyperLink> 
                </ItemTemplate> 
            </telerik:GridTemplateColumn>             
            <telerik:GridBoundColumn DataField="AgentName" DataType="System.String" HeaderText="Agent Name" SortExpression="AgentName" UniqueName="AgentName" /> 
            <telerik:GridBoundColumn DataField="WhseCity" DataType="System.String" HeaderText="City" SortExpression="WhseCity" UniqueName="WhseCity" /> 
            <telerik:GridBoundColumn DataField="WhseState" DataType="System.String" HeaderText="St" SortExpression="WhseState" UniqueName="WhseState" /> 
            <telerik:GridBoundColumn DataField="PrimeSCAC" DataType="System.String" HeaderText="SCAC" SortExpression="PrimeSCAC" UniqueName="PrimeSCAC" /> 
            <telerik:GridBoundColumn DataField="AgentClass" DataType="System.String" HeaderText="Class" SortExpression="AgentClass" UniqueName="AgentClass" /> 
            <telerik:GridBoundColumn DataField="Miles" DataType="System.String" HeaderText="Miles" SortExpression="Miles" UniqueName="Miles" /> 
            <telerik:GridBoundColumn DataField="DP3_OA_COUNT" DataType="System.String" HeaderText="OA" SortExpression="DP3_OA_COUNT" UniqueName="DP3_OA_COUNT" /> 
            <telerik:GridBoundColumn DataField="DP3_HLG_COUNT" DataType="System.String" HeaderText="HLG" SortExpression="DP3_HLG_COUNT" UniqueName="DP3_HLG_COUNT" /> 
            <telerik:GridBoundColumn DataField="DP3_DA_COUNT" DataType="System.String" HeaderText="DA" SortExpression="DP3_DA_COUNT" UniqueName="DP3_DA_COUNT" /> 
            <telerik:GridBoundColumn DataField="DP3_Q4_PERC" DataType="System.String" HeaderText="Q4%" SortExpression="DP3_Q4_PERC" UniqueName="DP3_Q4_PERC" /> 
            <telerik:GridBoundColumn DataField="DP3_Q5_PERC" DataType="System.String" HeaderText="Q5%" SortExpression="DP3_Q5_PERC" UniqueName="DP3_Q5_PERC" /> 
            <telerik:GridBoundColumn DataField="DP3_Q6_PERC" DataType="System.String" HeaderText="Q6%" SortExpression="DP3_Q6_PERC" UniqueName="DP3_Q6_PERC" /> 
            <telerik:GridBoundColumn DataField="DP3_Q7_PERC" DataType="System.String" HeaderText="Q7%" SortExpression="DP3_Q7_PERC" UniqueName="DP3_Q7_PERC" /> 
            <telerik:GridBoundColumn DataField="DP3_Q8_PERC" DataType="System.String" HeaderText="Q8%" SortExpression="DP3_Q8_PERC" UniqueName="DP3_Q8_PERC" /> 
            <telerik:GridBoundColumn DataField="ClaimsTotalShipments" DataType="System.String" HeaderText="12 Mth Cnt" SortExpression="ClaimsTotalShipments" UniqueName="ClaimsTotalShipments" /> 
            <telerik:GridBoundColumn DataField="QltyRatingDisplay" DataType="System.String" HeaderText="Qlty Rating" SortExpression="QltyRatingDisplay" UniqueName="QltyRatingDisplay" /> 
        </Columns> 
        <EditFormSettings> 
            <EditColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType"> 
            </EditColumn> 
        </EditFormSettings> 
    </MasterTableView>  
    <ClientSettings> 
        <Scrolling AllowScroll="True" UseStaticHeaders="true" /> 
    </ClientSettings> 
</telerik:RadGrid> 

search.ascx.vb
Protected Sub OnAjaxUpdate(ByVal sender As Object, ByVal args As ToolTipUpdateEventArgs) 
        Me.UpdateToolTip(args.Value, args.UpdatePanel) 
    End Sub 
 
    Private Sub UpdateToolTip(ByVal elementID As String, ByVal panel As UpdatePanel) 
        Dim ctrl As Control = Page.LoadControl("~/UserControls/Beta/AgentDetails.ascx") 
        panel.ContentTemplateContainer.Controls.Add(ctrl) 
 
        Dim details As UserControls_Beta_AgentDetails = DirectCast(ctrl, UserControls_Beta_AgentDetails) 
        details.AgentNumber = elementID 
    End Sub 
 
    Protected Sub radRadiusSearch_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles radRadiusSearch.ItemDataBound 
        If TypeOf e.Item Is GridDataItem Then 
            Dim item As GridDataItem = DirectCast(e.Item, GridDataItem) 
            Dim strAN As String = item("AgentNumber").Text 
            Dim strMiles As String = item("Miles").Text 
            Dim intMiles As Integer = 0 
            Dim strOA As String = item("DP3_OA_COUNT").Text 
            Dim strHLG As String = item("DP3_HLG_COUNT").Text 
            Dim strDA As String = item("DP3_DA_COUNT").Text 
            Dim strQ4 As String = item("DP3_Q4_PERC").Text 
            Dim strQ5 As String = item("DP3_Q5_PERC").Text 
            Dim strQ6 As String = item("DP3_Q6_PERC").Text 
            Dim strQ7 As String = item("DP3_Q7_PERC").Text 
            Dim strQ8 As String = item("DP3_Q8_PERC").Text 
            Dim strQlty As String = item("QltyRatingDisplay").Text 
            Dim target As Control = e.Item.FindControl("targetControl") 
            Dim targetLink As HyperLink = e.Item.FindControl("targetControl") 
            targetLink.NavigateUrl = "~/Tools/RadiusSearch-DP3/ShowAgent.aspx?AgentNumber=" & strAN 
            If Not [Object].Equals(target, Nothing) Then 
                If Not [Object].Equals(Me.radTTM, Nothing) Then 
                    Me.radTTM.TargetControls.Add(target.ClientID, (TryCast(e.Item, GridDataItem)).GetDataKeyValue("AgentNumber").ToString(), True) 
                End If 
            End If 
            If Len(strMiles) > 0 Then intMiles = CInt(strMiles) 
            item("Miles").Text = Math.Round(intMiles) 
            strQlty = Replace(strQlty, "-ACCEPTABLE", "") 
            strQlty = Replace(strQlty, "-UNKNOWN", "") 
            strQlty = Replace(strQlty, "-UNACCEPTABLE", "") 
            item("QltyRatingDisplay").Text = strQlty 
        End If 
    End Sub 
 
    Protected Sub radRadiusSearch_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles radRadiusSearch.ItemCommand 
        If e.CommandName = "Sort" OrElse e.CommandName = "Page" Then 
            radTTM.TargetControls.Clear() 
        End If 
    End Sub 
 
    Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender 
        'Version 2 - 5/6/2010 
        radRadiusSearch.PageSize = 25 
        radRadiusSearch.ClientSettings.Scrolling.SaveScrollPosition = False 
        radRadiusSearch.ClientSettings.Scrolling.FrozenColumnsCount = 2 
 
        If IsPostBack Then 
            Dim strZip As String = radZip.Text 
            Dim strCity As String = radCity.Text 
            Dim strState As String = radState.Text 
            Dim strMiles As String = radMiles.Text 
 
            Dim sqlConn As New SqlConnection 
            Dim sqlCmd As New SqlCommand 
 
            sqlConn.ConnectionString = ConfigurationManager.ConnectionStrings("zip_codesConnectionString").ConnectionString 
            sqlConn.Open() 
 
            If (Len(strZip) > 0 And Len(strMiles) > 0) Or (Len(strCity) > 0 And Len(strState) > 0 And Len(strMiles) > 0) Then 
                If Len(strZip) > 0 Then 
                    sqlCmd = New SqlCommand("_Radius_AgentSearch_DP3_ByZip", sqlConn) 
                    sqlCmd.CommandType = Data.CommandType.StoredProcedure 
                    sqlCmd.Parameters.AddWithValue("@ZipCode", strZip) 
                    sqlCmd.Parameters.AddWithValue("@Miles", strMiles) 
                Else 
                    sqlCmd = New SqlCommand("_Radius_AgentSearch_DP3_ByCityState", sqlConn) 
                    sqlCmd.CommandType = Data.CommandType.StoredProcedure 
                    sqlCmd.Parameters.AddWithValue("@City", strCity) 
                    sqlCmd.Parameters.AddWithValue("@State", strState) 
                    sqlCmd.Parameters.AddWithValue("@Miles", strMiles) 
                End If 
 
                radRadiusSearch.DataSource = sqlCmd.ExecuteReader 
                radRadiusSearch.DataBind() 
                radRadiusSearch.Visible = True 
            Else 
                radRadiusSearch.Visible = False 
            End If 
 
        End If 
    End Sub 
 
    Protected Sub cmdSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdSubmit.Click 
        radRadiusSearch.CurrentPageIndex = 0 
    End Sub 


Dimo
Telerik team
 answered on 13 May 2010
5 answers
264 views
I have a RadGrid that I am establishing cell styles in the itemdatabound method.  I export this grid to Excel .
     <ExportSettings HideStructureColumns="true" ExportOnlyData="false" IgnorePaging="true" Excel-Format="ExcelML" OpenInNewWindow="true" > 
     </ExportSettings> 
How do I preserve the cell styles (color, text color, bolding, etc ) that I set in the grid .
Maria Ilieva
Telerik team
 answered on 13 May 2010
1 answer
88 views
Hi,
I have a RadDatePicker inside a radwindow.
I am facing an issue with the RadDatePicker.
At the first time when I open the Radwindow it is showing the Calendar image properly. From the second time onwards whenever I open the window, it showing the Hyperlink text "Open the calendar pop up" instead of the Calendar image.
I am not sure why i am facing the issue.

Let us know that why this is happening and what might be the solution.

Thanks
Chandra
Mira
Telerik team
 answered on 13 May 2010
1 answer
131 views
Hello there, im testing the radgrid for a project, we are not using wizard to generate datasource so we manually paginate and sort, all works fine until i change page size, we have set page size=10, i select page size 20 and takes too long to load then i get error PageRequestManagerTimeoutException, then i return to select my 10 page size and i also get that error
what could be wrong?

i am binding the radgrid wih a class created after store procedures.
thanks! sorry for the bad english
Pavlina
Telerik team
 answered on 13 May 2010
5 answers
315 views
Hi,

Im trying to use rad tooltips to show html articles (that I store on a database) on multiple pages of a CMS.

Basically giving my client the ability to show articles everywhere just by using a tag with the respective ID.

So on the code I'd like to replace the "tooltip calling tag" with the actual tooltip code.

I managed to do the following so far:


<form runat="server"> 
 
<telerik:RadScriptManager ID="ScriptManager1" runat="server"  
    EnableTheming="True" OutputCompression="AutoDetect"> 
</telerik:RadScriptManager> 
 
 
<script type="text/javascript"> 
 function showToolTip(element) { 
     var tooltipManager = $find("<%= RadToolTipManager1.ClientID %>"); 
 
     if (!tooltipManager) return; 
 
     var tooltip = tooltipManager.getToolTipByElement(element); 
 
     if (!tooltip) { 
         tooltip = tooltipManager.createToolTip(element); 
     } 
 
     element.onmouseover = null; 
     tooltip.show(); 
 } 
</script> 
 
<telerik:RadToolTipManager ID="RadToolTipManager1" 
  Width="" 
  HideEvent="ManualClose" 
  RelativeTo="Element" 
  Position="BottomCenter" 
  runat="server" 
  Autotooltipify="false" 
  OffsetY="0" Sticky="True" Font-Bold="False" Title="Knowledge Database Helper"> 
</telerik:RadToolTipManager> 
 
<img title="<div><i>testing html</i></div><br/>" alt="test" src ="../template/images/knowledge.gif" ID="rad<%=id %>" onmouseover='showToolTip(this);' /> 
 
 
</form> 

The HTML code under the title tag would be gathered from the DB.

Is there any better way to populate tooltips with the HTML content without using the title attribute? because I also need to look at this code from the SEO point-of-view..

Thank you in advance.
Petio Petkov
Telerik team
 answered on 13 May 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?