Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
149 views
hey everyone i want to reduce space between columns. how to do this. i am using itemstyle-width but its increase the space..
how to solve this.. you can see in this picture.
Princy
Top achievements
Rank 2
 answered on 22 May 2014
3 answers
255 views
 HI,
I have created one form with dynamic telerik RadGRID with template columns as shown in the exmple URL: http://www.telerik.com/help/aspnet-ajax/grid-custom-edit-forms.html. Everything works fine except Extract values function does not return any values. Please follow below code example for better understanding.

public partial class TEST : System.Web.UI.Page
{
UserDetails _CurrentUser = null;
protected void Page_Init(object sender, EventArgs e)
{
_CurrentUser = (UserDetails)HttpContext.Current.Session["UserDetailSession"];

RadGrid RadGrid1 = new RadGrid();
RadGrid1.ID = "RadGrid1";
RadGrid1.AutoGenerateColumns = false;
RadGrid1.AllowPaging = true;
RadGrid1.AllowSorting = true;
RadGrid1.AllowFilteringByColumn = true;
RadGrid1.PageSize = 50;
RadGrid1.MasterTableView.EditMode = GridEditMode.InPlace;


RadGrid1.NeedDataSource += new GridNeedDataSourceEventHandler(RadGrid1_NeedDataSource);
RadGrid1.ItemCommand += new GridCommandEventHandler(RadGrid1_ItemCommand);

GridEditCommandColumn EditColumn = new GridEditCommandColumn();
RadGrid1.MasterTableView.Columns.Add(EditColumn);
EditColumn.UniqueName = "Edit";

List<clsColumnList> listColumnList = null;
DynamicPopulation _objDynamic = new DynamicPopulation();
  
 //please create few columns before usage of listColumnList
 foreach (clsColumnList _clsColumnList in listColumnList)
{
GridTemplateColumn _TemplateColumn = new GridTemplateColumn();
_TemplateColumn.ItemTemplate = new ItemTemplate(_clsColumnList.COLUMN_NAME);
_TemplateColumn.EditItemTemplate = new EditItemTemplate(_clsColumnList.COLUMN_NAME, _clsColumnList.DISPLAY_NAME, ViewState["ColumnList"] as List<clsColumnList>, Convert.ToInt32(Session["CurrentMeneID"]));
_TemplateColumn.DataField = _clsColumnList.COLUMN_NAME;
_TemplateColumn.HeaderText = _clsColumnList.DISPLAY_NAME;
_TemplateColumn.UniqueName = _clsColumnList.COLUMN_NAME;

RadGrid1.MasterTableView.Columns.Add(_TemplateColumn);
}

GridButtonColumn DeleteColumn = new GridButtonColumn();
RadGrid1.MasterTableView.Columns.Add(DeleteColumn);
DeleteColumn.ButtonType = GridButtonColumnType.LinkButton;
DeleteColumn.CommandName = "Delete";
DeleteColumn.Text = "Delete";
DeleteColumn.UniqueName = "Edit";
DeleteColumn.HeaderText = "Delete";
DeleteColumn.ConfirmText = "Are you sure, you want to delete?";
RadPane2.Controls.Add(RadGrid1);

}

protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
(sender as RadGrid).DataSource = string.Empty;
DynamicPopulation _objDynamic = new DynamicPopulation();
(sender as RadGrid).DataSource = _objDynamic.GetApplicationRolePackage(Convert.ToInt32(Session["CurrentMeneID"]));
}

protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
if (e.CommandName == RadGrid.EditCommandName)
{
(sender as RadGrid).MasterTableView.IsItemInserted = false;
}
if (e.CommandName == RadGrid.PerformInsertCommandName)
{
GridEditableItem row = e.Item as GridEditableItem;
Hashtable InsertValues = new Hashtable();
row.ExtractValues(InsertValues);
 
}
if (e.CommandName == RadGrid.UpdateCommandName)
{
GridEditableItem row = e.Item as GridEditableItem;
Hashtable InsertValues = new Hashtable();
row.ExtractValues(InsertValues);
}
if (e.CommandName == RadGrid.DeleteCommandName)
{
GridEditableItem row = e.Item as GridEditableItem;
Hashtable InsertValues = new Hashtable();
row.ExtractValues(InsertValues);
}
}
 }
}

public class EditItemTemplate : ITemplate, IBindableTemplate
{
protected LiteralControl _LiteralControl;
protected RequiredFieldValidator _RequiredFieldValidator;
protected HyperLink _HyperLink;
protected TextBox _Textbox;
protected CheckBox _Checkbox;
protected RadComboBox _RadComboBox;
private string colname;
private string DisplayName;
protected int MenuId;
List<clsColumnList> listClsColumnList;


public EditItemTemplate(string cName,string _DisplayName ,List<clsColumnList> _listClsColumnList, int _MenuId)
{
colname = cName;
DisplayName = _DisplayName;
listClsColumnList = _listClsColumnList;
MenuId = _MenuId;

}


public void InstantiateIn(Control container)
{
if (MenuId == 65)
{
if (colname == "BU_NM")
{
RadComboBox _RadComboBox = new RadComboBox();
_RadComboBox.ID = "EditlControlId_" + colname;
_RadComboBox.DataBinding += new EventHandler(RadCombbox_DataBinding);
container.Controls.Add(_RadComboBox);
}
else
{
RadTextBox _RadTextbox = new RadTextBox();
_RadTextbox.ID = "EditlControlId_" + colname;
_RadTextbox.DataBinding += new EventHandler(Textbox_DataBinding);
container.Controls.Add(_RadTextbox);
RequiredFieldValidator RFV = new RequiredFieldValidator();
RFV.ControlToValidate = _RadTextbox.ID;
RFV.ErrorMessage = "<br/>" + DisplayName + " is Mandatory";
container.Controls.Add(RFV);
//_LiteralControl = new LiteralControl();
//_LiteralControl.ID = "EditlControlId_" + colname;
//_LiteralControl.DataBinding += new EventHandler(lControl_DataBinding);
//container.Controls.Add(_LiteralControl);
}
}

}

public void lControl_DataBinding(object sender, EventArgs e)
{
LiteralControl l = (LiteralControl)sender;
GridDataItem container = (GridDataItem)l.NamingContainer;
l.Text = ((DataRowView)container.DataItem)[colname].ToString();
}

public void Textbox_DataBinding(object sender, EventArgs e)
{
RadTextBox l = (RadTextBox)sender;
GridDataItem container = (GridDataItem)l.NamingContainer;
l.Text = ((DataRowView)container.DataItem)[colname].ToString();
}

public void RadCombbox_DataBinding(object sender, EventArgs e)
{
if (MenuId == 65)
{
if (colname == "BU_NM")
{
RadComboBox cmbBusinessUnit = (RadComboBox)sender;
GridDataItem container = (GridDataItem)cmbBusinessUnit.NamingContainer;
string selectedvalue = ((DataRowView)container.DataItem)[colname].ToString();
cmbBusinessUnit.Items.Clear();
List<BusinessUnit> listBusinessUnits = BusinessUnitService.GetActiveBusinessUnitNames();
foreach (BusinessUnit obj in listBusinessUnits)
{
RadComboBoxItem item = new RadComboBoxItem(obj.business_unit_name, obj.business_unit_id.ToString());
cmbBusinessUnit.Items.Add(item);
if (obj.business_unit_name == selectedvalue)
item.Selected = true;
}
cmbBusinessUnit.Items.Insert(0, new RadComboBoxItem(string.Empty, string.Empty));
}
}

}

public System.Collections.Specialized.IOrderedDictionary ExtractValues(Control container)
{
IBindableControl control = container as IBindableControl;
GridEditFormItem item = container as GridEditFormItem;
System.Collections.Specialized.OrderedDictionary obj = new System.Collections.Specialized.OrderedDictionary();
if (MenuId == 65)
{
if (control != null)
{
control.ExtractValues(obj);
}

ControlCollection colletion = container.Controls;

//if (item != null)
//{ EditlControlId_DOMAIN_CD
if ((container.FindControl("EditlControlId_DOMAIN_CD") as TextBox) != null)
{
obj.Add("DOMAIN_CD", (item.FindControl("EditlControlId_DOMAIN_CD") as TextBox).Text);
}

if ((container.FindControl("EditlControlId_BU_NM") as TextBox) != null)
{
obj.Add("BU_NM", (item.FindControl("EditlControlId_DOMAIN_CD") as RadComboBox).SelectedValue);
}
//}

}
//KeyValuePair<int,string> _changes;

return obj;/// (IDictionaryEnumerator)_changes;
}


}

public class ItemTemplate : ITemplate
{
protected LiteralControl _LiteralControl;
protected RequiredFieldValidator _RequiredFieldValidator;
protected HyperLink _HyperLink;
protected TextBox _Textbox;
protected CheckBox _Checkbox;
protected RadComboBox _RadComboBox;
private string colname;

public ItemTemplate()
{

}

public ItemTemplate(string cName)
{
colname = cName;
}

public void InstantiateIn(Control container)
{
_LiteralControl = new LiteralControl();
_LiteralControl.ID = "lControlId_" + colname;
_LiteralControl.DataBinding += new EventHandler(lControl_DataBinding);
container.Controls.Add(_LiteralControl);

}

public void lControl_DataBinding(object sender, EventArgs e)
{
LiteralControl l = (LiteralControl)sender;
GridDataItem container = (GridDataItem)l.NamingContainer;
l.Text = ((DataRowView)container.DataItem)[colname].ToString();
}

}

public class DynamicPopulation
{
public List<clsColumnList> GetColumnList(int Menu_Id)
{
List<clsColumnList> listColumnList = null;
OracleConnection _connection = new OracleConnection(DataClasses.AppSettings.DBConnection);
try
{
string _sql = string.Format(@"SELECT COLUMN_NAME,
DISPLAY_NAME,
IS_REQUIRED,
COLUMN_TYPE
FROM MH_TABLE_COLUMNS_LIST
WHERE MENU_ID={0}
AND IS_ACTIVE=1
ORDER BY SEQUENCE_NO", Menu_Id);

using (OracleDataReader _reader = DataServices.Data.ExecuteReader(_sql, _connection))
{
if (_reader.HasRows)
{
listColumnList = new List<clsColumnList>();
while (_reader.Read())
{
clsColumnList obj = new clsColumnList();
obj.COLUMN_NAME = Convert.ToString(_reader["COLUMN_NAME"]);
obj.DISPLAY_NAME = Convert.ToString(_reader["DISPLAY_NAME"]);
obj.IS_REQUIRED = Convert.ToInt32(_reader["IS_REQUIRED"]);
obj.COLUMN_TYPE = Convert.ToString(_reader["COLUMN_TYPE"]);
listColumnList.Add(obj);
}
}
}
return listColumnList;
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (_connection != null)
{
_connection.Close();
_connection.Dispose();
}
}
}
///This class is used to create list of columns
[Serializable]
public class clsColumnList
{
public string COLUMN_NAME { get; set; }
public string DISPLAY_NAME { get; set; }
public int IS_REQUIRED { get; set; }
public String COLUMN_TYPE { get; set; }
}

Please dont tell me to follow already existing threads related to this topic becuase i already went through them and could not fand any luck.
Surendra
Top achievements
Rank 1
 answered on 22 May 2014
1 answer
300 views
<%@ Page AutoEventWireup="false" CodeFile="PamTest.aspx.vb" Inherits="PamTest"  %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 
 <html>
 <head>
    <title>ASP.NET RibbonBar Demo - Quick Access Toolbar</title>
</head>
<body>
 
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="false" />
  
     <div class="qsf-demo-canvas">
        <telerik:RadRibbonBar runat="server" ID="RadRibbonBar1" Skin="Windows7" Width="860px">          
            <Tabs>
                <telerik:RibbonBarTab Text="Taxonomies" ToolTip="Taxonomies">
                    <telerik:RibbonBarGroup Text="Taxonomies">
                        <Items>
                            <telerik:RibbonBarSplitButton Text="Test">
                                <Buttons>
                                    <telerik:RibbonBarButton  Text="Test1"/>
                                    <telerik:RibbonBarButton  Text="Test2"/>
                                </Buttons>
                            </telerik:RibbonBarSplitButton>
                           <telerik:RibbonBarButton Text="Open" Value="Open">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Close" Value="Close">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Edit" Value="Edit">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Copy" Value="Copy">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Paste" Value="Paste">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Print" Value="Print">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Print Preview" Value="Print Preview">
                           </telerik:RibbonBarButton>                                                                         
                        </Items>
                    </telerik:RibbonBarGroup>
                </telerik:RibbonBarTab>
                <telerik:RibbonBarTab Text="Collections" ToolTip="Collections">
                     <telerik:RibbonBarGroup Text="Collections">
                        <Items>                           
                           <telerik:RibbonBarButton Text="Open" Value="Open">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Close" Value="Close">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Edit" Value="Edit">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Copy" Value="Copy">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Paste" Value="Paste">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Print" Value="Print">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Print Preview" Value="Print Preview">
                           </telerik:RibbonBarButton>                                                                         
                        </Items>
                    </telerik:RibbonBarGroup>
                </telerik:RibbonBarTab>
                 <telerik:RibbonBarTab Text="Indexes" ToolTip="Indexes">
                     <telerik:RibbonBarGroup Text="Indexes">
                        <Items>                           
                           <telerik:RibbonBarButton Text="Open" Value="Open">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Close" Value="Close">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Edit" Value="Edit">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Copy" Value="Copy">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Paste" Value="Paste">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Print" Value="Print">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Print Preview" Value="Print Preview">
                           </telerik:RibbonBarButton>                                                                         
                        </Items>
                    </telerik:RibbonBarGroup>
                </telerik:RibbonBarTab>
                 <telerik:RibbonBarTab Text="Research Reviews" ToolTip="Research Reviews">
                     <telerik:RibbonBarGroup Text="Research Reviews">
                        <Items>                           
                           <telerik:RibbonBarButton Text="Open" Value="Open">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Close" Value="Close">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Edit" Value="Edit">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Copy" Value="Copy">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Paste" Value="Paste">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Print" Value="Print">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Print Preview" Value="Print Preview">
                           </telerik:RibbonBarButton>                                                                         
                        </Items>
                    </telerik:RibbonBarGroup>
                </telerik:RibbonBarTab>
                <telerik:RibbonBarTab Text="Audit" ToolTip="Audit">
                     <telerik:RibbonBarGroup Text="Audit">
                        <Items>                           
                           <telerik:RibbonBarButton Text="Open" Value="Open">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Close" Value="Close">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Edit" Value="Edit">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Copy" Value="Copy">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Paste" Value="Paste">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Print" Value="Print">
                           </telerik:RibbonBarButton>
                           <telerik:RibbonBarButton Text="Print Preview" Value="Print Preview">
                           </telerik:RibbonBarButton>                                                                         
                        </Items>
                    </telerik:RibbonBarGroup>
                </telerik:RibbonBarTab>
            </Tabs>
        </telerik:RadRibbonBar>
     </div>
  
    </form>
    <form id="form2" runat="server">   
    <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" Skin="Silk" EnableRoundedCorners="False" DecoratedControls="All" />
     
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" UpdateInitiatorPanelsOnly="true">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="SortLabel" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="ConfiguratorPanel">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="true"
        AllowSorting="True" GridLines="None" OnNeedDataSource="RadGrid1_NeedDataSource">
        <MasterTableView AllowMultiColumnSorting="true">
            <PagerStyle AlwaysVisible="true" />
            <Columns>
                  <telerik:GridNumericColumn DataField="MyColumn1" DataType="System.String" HeaderText="Column 1"
                    SortExpression="MyColumn1" UniqueName="MyColumn1">                   
                   </telerik:GridNumericColumn>
                    <telerik:GridNumericColumn DataField="MyColumn2" DataType="System.String" HeaderText="Column 2"
                    SortExpression="MyColumn2" UniqueName="MyColumn2">                   
                   </telerik:GridNumericColumn>
                    <telerik:GridNumericColumn DataField="MyColumn3" DataType="System.String" HeaderText="Column 3"
                    SortExpression="MyColumn3" UniqueName="MyColumn3">                   
                   </telerik:GridNumericColumn>
            </Columns>
        </MasterTableView>         
        <SortingSettings SortedBackColor="#FFF6D6" EnableSkinSortStyles="false"></SortingSettings>
        <HeaderStyle Width="100px"></HeaderStyle>
    </telerik:RadGrid>
     
    </form>   
 
</body>
</html>




This is my Code behind



Imports Microsoft.VisualBasic
Imports Telerik.Web.UI
 
 
Partial Class PamTest
    Inherits System.Web.UI.Page
    Protected WithEvents RadGrid1 As RadGrid
 
    Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs)
        Dim thedata As New List(Of MyData)
        thedata.Add(New MyData With {.MyColumn1 = "aa", .MyColumn2 = "dd", .MyColumn3 = "rr"})
        thedata.Add(New MyData With {.MyColumn1 = "bb", .MyColumn2 = "yy", .MyColumn3 = "ff"})
        thedata.Add(New MyData With {.MyColumn1 = "cc", .MyColumn2 = "xx", .MyColumn3 = "dd"})
        RadGrid1.DataSource = thedata
    End Sub
 
 
End Class
 
Class MyData
    Public Property MyColumn1 As Object
    Public Property MyColumn2 As Object
    Public Property MyColumn3 As Object
End Class




If I include Protected WithEvents RadGrid1 As RadGrid I get 'RadGrid1' is already declared as 'Protected WithEvents RadGrid1 As Telerik.Web.UI.RadGrid' in this class. If I remove that line "RadGrid1.DataSource = thedata" I get "unknown entity" for RadGrid1. What is wrong - thanks
Shinu
Top achievements
Rank 2
 answered on 22 May 2014
1 answer
74 views
I am trying to access the rad html chart series item values on client click. OnClientSeriesClicked event is working fine but firing the event twice.

Does anyone have the same issue? How to fix this?
Princy
Top achievements
Rank 2
 answered on 22 May 2014
1 answer
86 views
Hello.

I have on pie using radchart(html5), i want to change the tooltip text but only shows the percent, i want to set the name of the element.

Hope your answers.
Greats.
Stamo Gochev
Telerik team
 answered on 22 May 2014
3 answers
83 views
Hello

Not works clicked (tap) rows grid in mobiles

<telerik:RadGrid ID="exRdGridA" runat="server" GridLines="None" Width="100%"
                AllowCustomPaging="True" VirtualItemCount="100000" CellSpacing="0" Skin="Web20" AutoGenerateColumns="False">
                <MasterTableView AutoGenerateColumns="false">
                    <Columns>
                         
                        <telerik:GridBoundColumn DataField="PCL_ID" HeaderText="PCL_ID" UniqueName="PCL_ID" />
                        <telerik:GridBoundColumn DataField="JOB_ID" HeaderText="JOB_ID" UniqueName="JOB_ID" />
                        <telerik:GridBoundColumn DataField="JOB_ID_Current" HeaderText="JOB_ID_Current" UniqueName="JOB_ID_Current" />
                        <telerik:GridBoundColumn DataField="PCL_Summ" HeaderText="PCL_Summ" UniqueName="PCL_Summ" />
                        <telerik:GridBoundColumn DataField="PCL_Balance" HeaderText="PCL_Balance" UniqueName="PCL_Balance" />
                        <telerik:GridBoundColumn DataField="PCL_Notes" HeaderText="PCL_Notes" UniqueName="PCL_Notes" />
                    </Columns>
                </MasterTableView>
                <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="true">
                    <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" />
                </ClientSettings>
            </telerik:RadGrid>
Venelin
Telerik team
 answered on 22 May 2014
5 answers
169 views
Hi All,

I'm using telerik Q3 for development. I put a RadTreeList in a NestedViewTemplate of a RadGrid, then bind the RadTreeList data in NeedDataSource event. It worked in IE8+, but for the IE7, the content can NOT show while the header show perfect. Can any one help on this?

Code as bellow:
<telerik:RadGrid ID="blockdetails_grid" runat="server" CssClass="teterik_chart_grid telerik-grid" Height="99.8%" Width="99.8%" ShowStatusBar="true" AutoGenerateColumns="False"
AllowMultiRowSelection="False" GridLines="None" AllowPaging="true" PageSize="10" OnItemDataBound="BlockDetails_Grid_ItemDataBound"
OnNeedDataSource="BlockDetails_Grid_NeedDataSource" OnItemCommand="BlockDetails_Grid_ItemCommand">
<ClientSettings EnableRowHoverStyle="true">
<Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" />
</ClientSettings>
<PagerStyle Mode="NumericPages"></PagerStyle>
<MasterTableView Width="100%" DataKeyNames="Name" AllowMultiColumnSorting="false">
<HeaderStyle BackColor="#E1E1E1" />
<NestedViewTemplate>
<telerik:RadTreeList runat="server" ID="blockdetails_treelist" CssClass="teterik_chart_grid telerik-treelist" Height="99.8%" Width="99.8%"
DataKeyNames="i_session_id" ParentDataKeyNames="i_blocked_by" OnNeedDataSource="BlockDetails_TreeList_NeedDataSource"
AutoGenerateColumns="false" ShowTreeLines="false">
<HeaderStyle BackColor="#E1E1E1" />
<Columns>
<telerik:TreeListTemplateColumn HeaderText="SessionID" DataField="i_session_id" UniqueName="i_session_id" HeaderStyle-Width="5%" ItemStyle-Width="5%">
<ItemTemplate>
<asp:LinkButton runat="server" ID="sessionid_linkbutton" Text='<%# DataBinder.Eval(Container.DataItem, "i_session_id") %>' OnClientClick="return clientSessionIDClick(this);"></asp:LinkButton>
</ItemTemplate>
</telerik:TreeListTemplateColumn>
<telerik:TreeListBoundColumn HeaderText="Level" DataField="i_level" UniqueName="i_level" HeaderStyle-Width="5%" ItemStyle-Width="5%"></telerik:TreeListBoundColumn>
 </Columns>
</telerik:RadTreeList>
</NestedViewTemplate>
<Columns>
<telerik:GridBoundColumn HeaderText="Server Name" DataField="Name" UniqueName="ServerName" HeaderButtonType="TextButton">
</telerik:GridBoundColumn>
 </Columns>
</MasterTableView>
</telerik:RadGrid>
Eyup
Telerik team
 answered on 22 May 2014
13 answers
294 views
Hello Telerik Team,

Need urgent help from you guys.

1) i am displaying all PDF files stored on Directory from specific path inside the radgrid using "GridHyperLinkColumn".

2) the display is perfect but when clicked on the link the path taken is not fully correct and Hence cannot open the Files.

Actual Path ="../help/PDFfiles/*.pdf"
Path Taken = "../help/*.pdf"
It cannot take PDFFiles folder and hence fiel cannot be display
Please help for the same. Below is the code as shown.

<form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <telerik:RadGrid ID="gridFilesDisplay" runat="server" >
                       <MasterTableView EditMode="InPlace" ShowHeadersWhenNoRecords="true" AllowFilteringByColumn="false">
                <Columns>
   <telerik:GridHyperLinkColumn DataNavigateUrlFields="Name" DataTextField="Name" HeaderText="Document Name">    ></telerik:GridHyperLinkColumn>            
                 </Columns>
                    <PagerStyle Mode="NextPrevNumericAndAdvanced" />
              </MasterTableView>
        </telerik:RadGrid>
    </form>
  
************************** CODEBEHIND******************************
  
protected void Page_Load(object sender, EventArgs e)
        {
  
            if (!IsPostBack)
            {
                      sPath = "..//help/PDFFILES//"    //(This value taken from webconfig)
                DirectoryInfo objDirectory = new DirectoryInfo(Server.MapPath(sPath));
                   
                 gridFilesDisplay.DataSource = objDirectory.GetFiles("*.pdf");
                gridFilesDisplay.DataBind();
            }
  
}

 

Kostadin
Telerik team
 answered on 22 May 2014
12 answers
833 views
Hi All!

I have a radgrid that uses a SQL database for its datasource.  The fields are of type "date" so there are no times in the database fields.  However, my radgrid adds 12:00:00 AM to all of its times.  I have attempted DateFormatString = "{0:MM/dd/yy}" or "{0,d}" but neither seem to work.  Any thoughts?

Thanks,
Mark
Eyup
Telerik team
 answered on 22 May 2014
1 answer
134 views
Hi,

I have an issue refreshing a radscheduler using Telerik ajax
My page contains a RadTabStrip, one of which is containing a RadScheduler.
When I update one of my page element using Telerik ajax, I would like my scheduler to be regreshed but despite my Appointments list is being refreshed server side, the scheduler is not refreshed clietn side whereas another ajaxified field is.
I have readed many threads on the forum but i still did not find a solution

Below are some extract of the code:

.aspx
<telerik:RadAjaxManager ID="PageRadAjaxManager" runat="server" OnAjaxRequest="PageRadAjaxManager_AjaxRequest">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="PageRadAjaxManager">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="TxtIltExtid" />
                        <telerik:AjaxUpdatedControl ControlID="InstructorId" />
                        <telerik:AjaxUpdatedControl ControlID="LblInstructorName" />
                        <telerik:AjaxUpdatedControl ControlID="IltRoomId" />
                        <telerik:AjaxUpdatedControl ControlID="LblIltRoomName" />
                        <telerik:AjaxUpdatedControl ControlID="InstructorRadGrid" />
                        <telerik:AjaxUpdatedControl ControlID="DiaryRadScheduler" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="InstructorRadGrid">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="InstructorRadGrid" />
                    </UpdatedControls
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="DiaryRadScheduler">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="DiaryRadScheduler" />
                    </UpdatedControls
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>

<telerik:RadPageView runat="server" ID="lsched_diary_pv" TabIndex="2">
                        <div class="LschedAdminContent">
                            <br />
                            <telerik:radscheduler runat="server" id="DiaryRadScheduler"
                                DataKeyField="ID" DataSubjectField="Subject" DataStartField="Start" DataEndField="End" DataDescriptionField="Description"
                                DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentId" DataReminderField="Reminder"
                                OnAppointmentDataBound="DiaryRadScheduler_AppointmentDataBound"
                                AllowDelete="false" AllowEdit="false" AllowInsert="false" EnableDescriptionField="true"
                                EnableRecurrenceSupport="false" EnableResourceEditing="false" EnableExactTimeRendering="false"
                                DayStartTime="08:00:00" DayEndTime="20:00:00" WorkDayStartTime="08:00:00" WorkDayEndTime="20:00:00"
                                WeekView-DayStartTime="08:00:00" WeekView-DayEndTime="20:00:00" WeekView-WorkDayStartTime="08:00:00" WeekView-WorkDayEndTime="20:00:00" WeekView-EnableExactTimeRendering="true"
                                MultiDayView-DayStartTime="08:00:00" MultiDayView-DayEndTime="20:00:00" MultiDayView-WorkDayStartTime="08:00:00" MultiDayView-WorkDayEndTime="20:00:00" MultiDayView-NumberOfDays="5" MultiDayView-EnableExactTimeRendering="true"
                                AppointmentStyleMode="Auto" SelectedView="WeekView"
                                StartEditingInAdvancedForm="true" StartInsertingInAdvancedForm="true"
                                ShowHeader="true" ShowFooter="true" ShowAllDayRow="false" ShowDateHeaders="true" ShowFullTime="false" OverflowBehavior="Expand"
                                RowHeight="25px" RowHeaderWidth="50px" MinutesPerRow="60" TimeLabelRowSpan="2"
                                FirstDayOfWeek="Monday" LastDayOfWeek="Sunday" HoursPanelTimeFormat="HH:mm tt"
                                OnResourceHeaderCreated="DiaryRadScheduler_ResourceHeaderCreated" GroupBy="Type">
                                <DayView HeaderDateFormat="d" UserSelectable="true" />
                                <WeekView HeaderDateFormat="d" UserSelectable="true" />
                                <MonthView HeaderDateFormat="d" UserSelectable="true" />
                                <AgendaView HeaderDateFormat="d" UserSelectable="false" />
                                <TimelineView UserSelectable="false" />
                                <MultiDayView UserSelectable="false" />
                                <AdvancedForm Modal="true" />
                                <ResourceHeaderTemplate>
                                    <asp:Panel ID="HeaderLabelWrapper" runat="server">
                                        <%# Eval("Text") %>
                                    </asp:Panel>
                                </ResourceHeaderTemplate>
                                <AppointmentTemplate>
                                    <%# Eval("Subject") %><br /><%# Eval("Description") %>
                                </AppointmentTemplate>
                            </telerik:radscheduler>
                        </div>
                    </telerik:RadPageView>

.aspx.cs

...
using Telerik.Web.UI;
...
 
namespace WBTManager.manageILT
{
    public partial class lsched : System.Web.UI.Page
    {
        #region Variables
        ...
        List<AppointmentInfo> Appointments = new List<AppointmentInfo>();
        #endregion Variables
 
        protected void Page_Init(object sender, EventArgs e)
        {
            ...
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Session or ViewState
            ...
            if (ViewState["Appointments"] != null)
                Appointments = (List<AppointmentInfo>)ViewState["Appointments"];
            #endregion Session or ViewState
 
            if (!IsPostBack)
            {
                ...
 
                #region Fill values
                ...
                // Schedule Pageview
                if (oLsched != null && (oLsched.Iltroom_Id > 0 || oLsched.Instruc_Id > 0))
                {
                    // RadScheduler culture
                    DiaryRadScheduler.Culture = new System.Globalization.CultureInfo(sCulture);
                    // RadScheduler default date
                    DiaryRadScheduler.SelectedDate = DateTime.Now;
                    // RadScheduler fill
                    InitializeResources();
                    InitializeAppointments();
                    DiaryRadScheduler.DataSource = Appointments;
                    DiaryRadScheduler.DataBind();
                }
                ...
                #endregion Fill values
 
                ...
            }
 
            ...
        }
 
        protected void Page_PreRender(object sender, EventArgs e)
        {
            ...
            if (Appointments != null)
                ViewState["Appointments"] = Appointments;
        }
 
        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            ...
        }
 
        // Ajax request
        public void PageRadAjaxManager_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            bool bRefreshLessonGrid = false;
            bool bRefreshDiary = false;
            string argument = (e.Argument);
            string[] argumentArray = argument.Split("|".ToCharArray(), StringSplitOptions.None);
            ...
            string sUpdateScript = "";
            if (bRefreshDiary && oLsched != null)
            {
                //DiaryRadScheduler.Resources.Clear();
                //DiaryRadScheduler.Appointments.Clear();
                // RadScheduler fill
                Appointments = new List<AppointmentInfo>();
                InitializeResources();
                InitializeAppointments();
                DiaryRadScheduler.DataSource = Appointments;
                DiaryRadScheduler.DataBind();
                //sUpdateScript += "setTimeout(\"forceCalendarRender()\", 500);";
            }
           ...
            if (!string.IsNullOrWhiteSpace(sUpdateScript))
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "UpdateScript", sUpdateScript, true);
        }
 
        protected void DiaryRadScheduler_ResourceHeaderCreated(object sender, ResourceHeaderCreatedEventArgs e)
        {
            Panel HeaderLabelWrapper = e.Container.FindControl("HeaderLabelWrapper") as Panel;
            if (e.Container.Resource.Key.ToString() == "0")
                HeaderLabelWrapper.CssClass = "ResourceIlt";
            else if (e.Container.Resource.Key.ToString() == "1")
                HeaderLabelWrapper.CssClass = "ResourceInstructor";
        }
 
        protected void DiaryRadScheduler_AppointmentDataBound(object sender, Telerik.Web.UI.SchedulerEventArgs e)
        {
            if (e.Appointment.Resources.GetResourceByType("Type") != null)
            {
                switch ((int)e.Appointment.Resources.GetResourceByType("Type").Key)
                {
                    case 0:
                        e.Appointment.CssClass = "rsCategoryILT";
                        break;
                    case 1:
                        e.Appointment.CssClass = "rsCategoryInstructor";
                        break;
                    default:
                        break;
                }
            }
        }
 
        private void InitializeResources()
        {
            // 0 Room
            // 1 Instructor
            DiaryRadScheduler.ResourceTypes.Clear();
            ResourceType resType = new ResourceType("Type");
            resType.ForeignKeyField = "Type";
            DiaryRadScheduler.ResourceTypes.Add(resType);
            DiaryRadScheduler.Resources.Clear();
            //DiaryRadScheduler.Resources.Add(new Resource("Type", 0, oLoc.GetString("LblDiaryTypeRoom", oUser.Subdomain) + ((oLsched.Iltroom_Id > 0) ? " : " + LblIltRoomName.Text : "")));
            DiaryRadScheduler.Resources.Add(new Resource("Type", 0, oLoc.GetString("LblDiaryTypeRoom", oUser.Subdomain) + " : " + LblIltRoomName.Text));
            //DiaryRadScheduler.Resources.Add(new Resource("Type", 1, oLoc.GetString("LblDiaryTypeInstructor", oUser.Subdomain) + ((oLsched.Instruc_Id > 0) ? " : " + LblInstructorName.Text : "")));
            DiaryRadScheduler.Resources.Add(new Resource("Type", 1, oLoc.GetString("LblDiaryTypeInstructor", oUser.Subdomain) + " : " + LblInstructorName.Text));
        }
 
        private void InitializeAppointments()
        {
            DiaryRadScheduler.Appointments.Clear();
            // Display booking for the room
            if (oLsched.Iltroom_Id > 0)
            {
                DataSet dSchedule = Iltroom.GetIltroomScheduleDS(oLsched.Iltroom_Id, oUser.Lang_Id);
                foreach (DataRow mSchedule in dSchedule.Tables["Schedule"].Rows)
                {
                    #region Room
                    DateTime mTmpStartTime;
                    DateTime.TryParse(mSchedule["SCHSTART"].ToString(), out mTmpStartTime);
                    DateTime mTmpEndTime;
                    DateTime.TryParse(mSchedule["SCHEND"].ToString(), out mTmpEndTime);
                    string mTmpCourse = mSchedule["COURSE_NAME"].ToString();
                    string mTmpCsExtid = mSchedule["CS_EXTID"].ToString();
                    string mTmpLesson = mSchedule["LESSON_NAME"].ToString();
                    string mTmpLsExtid = mSchedule["LS_EXTID"].ToString();
                    string mTmpInstructor = mSchedule["INSTRUCTOR"].ToString();
 
                    if (mTmpStartTime != DateTime.MinValue && mTmpStartTime != new DateTime(1900, 1, 1) &&
                        mTmpEndTime != DateTime.MinValue && mTmpEndTime != new DateTime(1900, 1, 1) &&
                        !string.IsNullOrWhiteSpace(mTmpCourse) && !string.IsNullOrWhiteSpace(mTmpLesson) &&
                        !string.IsNullOrWhiteSpace(mTmpCsExtid) && !string.IsNullOrWhiteSpace(mTmpLsExtid))
                    {
                        string sSubject = oLoc.GetString("LblCourse", oUser.Subdomain) + " : " + mTmpCourse + Environment.NewLine + mTmpCsExtid;
                        string sDescription = oLoc.GetString("LblLesson", oUser.Subdomain) + " : " + mTmpLesson + Environment.NewLine + mTmpLsExtid;
                        if (!string.IsNullOrWhiteSpace(mTmpInstructor))
                            sDescription += "<br />" + oLoc.GetString("LblInstructor", oUser.Subdomain) + " : " + mTmpInstructor;
                        Appointments.Add(new AppointmentInfo(sSubject, sDescription, mTmpStartTime, mTmpEndTime, string.Empty, null, string.Empty, 0));
                    }
                    #endregion Room
                }
            }
            // Display booking for the instructor
            if (oLsched.Instruc_Id > 0)
            {
                DataSet dSchedule = Students.GetLschinstrucDS(oLsched.Instruc_Id,  oUser.Lang_Id, false, DateTime.Now);
                foreach (DataRow mLschinstruc in dSchedule.Tables["Lschinstruc"].Rows)
                {
                    #region Instructor
                    DateTime mTmpStartTime;
                    DateTime.TryParse(mLschinstruc["SCHSTART"].ToString(), out mTmpStartTime);
                    DateTime mTmpEndTime;
                    DateTime.TryParse(mLschinstruc["SCHEND"].ToString(), out mTmpEndTime);
                    string mTmpCourse = mLschinstruc["COURSE_NAME"].ToString();
                    string mTmpCsExtid = mLschinstruc["CS_EXTID"].ToString();
                    string mTmpLesson = mLschinstruc["LESSON_NAME"].ToString();
                    string mTmpLsExtid = mLschinstruc["LS_EXTID"].ToString();
                    string mTmpCenter = mLschinstruc["ILTLOC_NAME"].ToString();
                    string mTmpRoom = mLschinstruc["ILTROOM_NAME"].ToString();
 
                    if (mTmpStartTime != DateTime.MinValue && mTmpStartTime != new DateTime(1900, 1, 1) &&
                        mTmpEndTime != DateTime.MinValue && mTmpEndTime != new DateTime(1900, 1, 1) &&
                        !string.IsNullOrWhiteSpace(mTmpCourse) && !string.IsNullOrWhiteSpace(mTmpLesson) &&
                        !string.IsNullOrWhiteSpace(mTmpCsExtid) && !string.IsNullOrWhiteSpace(mTmpLsExtid))
                    {
                        string sSubject = oLoc.GetString("LblCourse", oUser.Subdomain) + " : " + mTmpCourse + Environment.NewLine + mTmpCsExtid;
                        string sDescription = oLoc.GetString("LblLesson", oUser.Subdomain) + " : " + mTmpLesson + Environment.NewLine + mTmpLsExtid;
                        if (!string.IsNullOrWhiteSpace(mTmpCenter))
                            sDescription += "<br />" + oLoc.GetString("LblIltLocation", oUser.Subdomain) + " : " + mTmpCenter;
                        if (!string.IsNullOrWhiteSpace(mTmpRoom))
                            sDescription += "<br />" + oLoc.GetString("LblIltRoom", oUser.Subdomain) + " : " + mTmpRoom;
                        Appointments.Add(new AppointmentInfo(sSubject, sDescription, mTmpStartTime, mTmpEndTime, string.Empty, null, string.Empty, 1));
                    }
                    #endregion Instructor
                }
            }
        }
 
        [Serializable]
        class AppointmentInfo
        {
            ...
        }
    }
}

When debugging step by step, I update appointments list but it never appears correctly on client side
Moreover, if my appointment list is empty at first load, depending on my browser, the radscheduler is sometimes shrinked with a javascript error in the axd file..

If any one has a good idea....it would be greatly appreciated

Regards.
Boyan Dimitrov
Telerik team
 answered on 22 May 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?