Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
100 views
Hi,

How do I change the dates marked with red here:
http://test.co3.dk/rune/scheduler.jpg

I am not happy with the format, and need to change it to maybe "Monday, 1." maybe even "Monday 1. january.

I hope someone can help

Thanks
Rune
Rune
Top achievements
Rank 2
 answered on 14 Jan 2010
2 answers
226 views
Hi,

I am using a RadGrid. For this grid AutogenerateColumn = true. I will bind the grid dynamically.
And i am adding FilterTemplate for the columns in "rgridList_ColumnCreated" event.

I have customized the Filters i.e) For String Columns the filter may be 'TextBox' or 'Combo' based on a condition.
For numeric columns filter will be a slider. for this i am have created my own classes which will inherit "ITemplate"

i.e) I have created following classes
GridTextBoxFilterTemplate : ITemplate [ For Textbox Filter ]
GridComboFilterTemplate : ITemplate [ For Combo Filter ]
GridSliderFilterTemplate :ITemplate [ For Slider Filter ]

These filters are working properly

Similarly i have created a class(GridDatePickerFilterTemplate), to filter grid records based on a DateTime column
If i add Filter template for a datetime column it is not added. I don't know y?

 
protected void rgridList_ColumnCreated(object source, Telerik.Web.UI.GridColumnCreatedEventArgs e){ 
            switch (e.Column.ColumnType) {   
                case "GridBoundColumn": 
                    GridBoundColumn boundColumn = e.Column as GridBoundColumn; 
                    GridTextBoxFilterTemplate lObjTextBoxFilterTemplate; 
                    GridComboFilterTemplate lObjComboFilterTemplate; 
                    GridSliderFilterTemplate lObjSliderFilterTemplate; 
                    GridDatePickerFilterTemplate lObjRadDateTimePicker; 
  
                            if (boundColumn.DataType == Type.GetType("System.String")){ 
  
                                if(dtSource.DefaultView.ToTable(true, boundColumn.UniqueName).Rows.Count > WebConfig.TextBoxFilter){ 
                                    //To add textbox as in filter template for string columns 
                                    lObjTextBoxFilterTemplate = new GridTextBoxFilterTemplate(); 
                                    lObjTextBoxFilterTemplate.ColumnName = boundColumn.UniqueName; 
                                    if (htFilter[boundColumn.UniqueName] != null) 
                                    //To maintain existing filter value 
                                    lObjTextBoxFilterTemplate.FilterValue = Convert.ToString(htFilter[boundColumn.UniqueName]); 
                                    else 
                                        lObjTextBoxFilterTemplate.FilterValue = ""
                                    lObjTextBoxFilterTemplate.TableViewClientId = rgridList.MasterTableView.ClientID; 
                                    boundColumn.FilterTemplate = lObjTextBoxFilterTemplate
                                } 
                                else{ 
                                //To add combo as in filter template for string columns 
                                lObjComboFilterTemplate = new GridComboFilterTemplate(); 
                                dtSource.DefaultView.Sort = boundColumn.UniqueName; 
                                lObjComboFilterTemplate.DataSource = dtSource.DefaultView.ToTable(true, boundColumn.UniqueName); 
                                lObjComboFilterTemplate.DataTextField = boundColumn.UniqueName; 
                                lObjComboFilterTemplate.DataValueField = boundColumn.UniqueName; 
                                  
                                if (htFilter[boundColumn.UniqueName] != null) 
                                    //To maintain existing filter value 
                                    lObjComboFilterTemplate.FilterValue = Convert.ToString(htFilter[boundColumn.UniqueName]);//boundColumn.CurrentFilterValue 
                                lObjComboFilterTemplate.TableViewClientId = rgridList.MasterTableView.ClientID; 
  
                                boundColumn.FilterTemplate = lObjComboFilterTemplate
                                } 
                            } 
                            else if (boundColumn.DataType == Type.GetType("System.Int16") || 
                                boundColumn.DataType == Type.GetType("System.Int32") || 
                                boundColumn.DataType == Type.GetType("System.Int64") || 
                                boundColumn.DataType == Type.GetType("System.Decimal") || 
                                boundColumn.DataType == Type.GetType("System.Double")){ 
                                //To add slider in filter template for numeric columns 
                                lObjSliderFilterTemplate = new GridSliderFilterTemplate(); 
                                lObjSliderFilterTemplate.ColumnName = boundColumn.UniqueName; 
                                lObjSliderFilterTemplate.StartValue = Convert.ToInt32(Session["startSlider"]); 
                                lObjSliderFilterTemplate.EndValue = Convert.ToInt32(Session["endSlider"]); 
                                  
                                dtSource.DefaultView.Sort = boundColumn.HeaderText + " DESC"; 
                                //DataRow dr = dtSource.Select("Max('[" + boundColumn.HeaderText + "]')")[0]; 
                                lObjSliderFilterTemplate.MaxValue = Convert.ToInt32(dtSource.DefaultView[0][boundColumn.HeaderText]); 
                                boundColumn.FilterTemplate = lObjSliderFilterTemplate
                            } 
                    break; 
                case "GridDateTimeColumn": 
                    //To assign DataFormatString for DateTime columns 
                    GridDateTimeColumn dateColumn = e.Column as GridDateTimeColumn; 
                    dateColumn.DataFormatString = "{0:MM/dd/yyyy}"
  
                                    //To add filter template 
                                    lObjRadDateTimePicker = new GridDatePickerFilterTemplate(); 
                                    lObjRadDateTimePicker.ColumnName = dateColumn.UniqueName; 
                                    if (htFilter[dateColumn.UniqueName] != null) 
                                    //To maintain existing filter value 
                                    lObjRadDateTimePicker.FilterValue = Convert.ToString(htFilter[dateColumn.UniqueName]); 
                                    else 
                                        lObjRadDateTimePicker.FilterValue = ""
                                    lObjRadDateTimePicker.TableViewClientId = rgridList.MasterTableView.ClientID; 
                                    dateColumn.FilterTemplate  = lObjRadDateTimePicker
  
                    break; 
            } 
        }  


Help me in this.........
How to add a FilterTemplate for a 'GridDateTimeColumn' by programmatic?

Thanks,
Ravi AG
Rohit
Top achievements
Rank 1
 answered on 14 Jan 2010
1 answer
238 views
I have a RadDatePicker that if the user changes the date I have a confirm message to ask if the want to change the date.
If they click no I want to change the date back to its original value.
In my java script I have
var datepicker = $find("datePicker");
datepicker.set_selectedDate(args._oldDate);

when I set the selected date the function is called again and I am stuck in an Infinate loop since everytime I am setting the selected date in javascript the function is calling its self. I just want it so that if the user clicks no that the date will not change. I haven't been able to find anything on this site to fix it.

Thanks
Shinu
Top achievements
Rank 2
 answered on 14 Jan 2010
2 answers
106 views
I have RadRotator in my Home page and here is the following code.

                    <telerik:RadRotator ID="RadRotator1" runat="server" Width="400" ItemWidth="400" Height="300" ItemHeight="300"
                        RotatorType="AutomaticAdvance" SlideShowAnimation-Duration="1000">
                        <ItemTemplate>
                            <asp:Image CssClass="itemTemplate" ID="Image1" runat="server" ImageUrl='<%# "images/SlideShow/" & DataBinder.Eval(Container.DataItem, "cd_value") %>' AlternateText='<%# DataBinder.Eval(Container.DataItem, "ds_description") %>' />
                        </ItemTemplate>
                    </telerik:RadRotator>

Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
             'Load Slide Show Images
            RadRotator1.DataSource = Dataset.Tables(0)
            RadRotator1.DataBind()
    End Sub

When i visit the home page first time everything works fine but if i navigate to contactus page and come back to Home page i can't see the RadRotator image again but HTML has entry for images. I also see Javascript error invalid argument.



Any help will be really helpful, as we are close to project deadline. Thanks
Harah Day
Top achievements
Rank 1
 answered on 13 Jan 2010
1 answer
71 views

 

 

Version: 2009.3.1208.35

Dim
FindNode As RadTreeNode = Me.RadTreeViewTerritories.Nodes.FindNodeByValue(46)

Comes back set to Nothing, but if I set a break point and debug the object using the Immediate Window
this is the results, it finds it.  Node has 3 levels.

 

? RadTreeViewTerritories.Nodes.FindNodeByValue(46)

Nothing

? RadTreeViewTerritories.Nodes(0).Nodes(0).Nodes.FindNodeByValue(46) .Text

"Node 5"

Looks like it won't transverse the node tree.
What I'm doing wrong?

FYI: What I'm trying to do is rename the Node from a textbox and have it refresh (Server Side)

Thanks
John

 

 

John Adkins
Top achievements
Rank 1
 answered on 13 Jan 2010
3 answers
190 views
I am working with emulating the RadGrid demo found here: Grid Demo - Hierarchy.  I am able to attach to the w3wp.exe process to debug and even get inside the event 'ItemDataBound' when it is raised.  Instead of using the control SQLDataSource I in turn am using a DataSet populated with DataTables.  Here is my code for my webpart:

        protected override void CreateChildControls()  
        {  
            base.CreateChildControls();  
 
            try 
            {  
                da = new DataAccess();  
 
                strArea = "SubSite Name";  
                strListName = "List Name";  
                strView = "All Documents";  
 
                ds = da.GetListData(strArea, strListName, strView);  
 
                this.EnsureUpdatePanelFixups();  
                UpdatePanel up = new UpdatePanel();  
                up.ID = "UpdatePanel1";  
                up.ChildrenAsTriggers = true;  
                up.UpdateMode = UpdatePanelUpdateMode.Conditional;  
                this.Controls.Add(up);  
 
                //  Example of adding RadGrid to Moss 2007 site using a RadGrid  
                // *************************************************************  //  
                rdDocs = new RadGrid();  
                rdDocs.ID = "rdDocs";  
 
                rdDocs.DetailTableDataBind += new GridDetailTableDataBindEventHandler(rdDocs_DetailTableDataBind);  
                rdDocs.ItemCommand += new GridCommandEventHandler(rdDocs_ItemCommand);  
                rdDocs.ItemDataBound += new GridItemEventHandler(rdDocs_ItemDataBound);  
 
                rdDocs.PageSize = 30;  
                rdDocs.AllowPaging = true;  
                rdDocs.AllowSorting = true;  
                rdDocs.GridLines = GridLines.None;  
                rdDocs.ShowStatusBar = true;  
                rdDocs.PagerStyle.Mode = GridPagerMode.NumericPages;  
 
                rdDocs.AutoGenerateColumns = false;  
 
                GridBoundColumn gbcID = new GridBoundColumn();  
                GridBoundColumn gbcLinkFileName = new GridBoundColumn();  
                GridBoundColumn gbcPrimaryPOC = new GridBoundColumn();  
 
                gbcID.DataField = "ID";  
                gbcID.HeaderText = "Document ID";  
                gbcID.Visible = false;  
 
                gbcLinkFileName.DataField = "LinkFilename";  
                gbcLinkFileName.HeaderText = "Documents";  
 
                gbcPrimaryPOC.DataField = "Primary_x0020_POC";  
                gbcPrimaryPOC.HeaderText = "Primary POC";  
 
                rdDocs.Columns.Add(gbcID);  
                rdDocs.Columns.Add(gbcLinkFileName);  
                rdDocs.Columns.Add(gbcPrimaryPOC);  
 
                rdDocs.Width = Unit.Percentage(95);  
                rdDocs.DataSource = ds.Tables[0];  
                rdDocs.DataBind();  
 
                up.ContentTemplateContainer.Controls.Add(rdDocs);  
 
                // *************************************************************  //  
 
                //  Example of adding RadGrid to Moss 2007 site using a RadGrid  
                // *************************************************************  //  
                GridTableView rdSndPOCs = new GridTableView();  
                GridTableViewRelation gtvrSndPOCs = new GridTableViewRelation();  
 
                rdSndPOCs.ID = "rdSndPOCs";  
                rdSndPOCs.Caption = "Secondary POCs";  
 
                GridRelationFields grfSndPOCs = new GridRelationFields();  
                grfSndPOCs.DetailKeyField = "ID";  
                grfSndPOCs.MasterKeyField = "ID";  
 
                rdDocs.MasterTableView.ParentTableRelation.Add(grfSndPOCs);  
 
                gtvrSndPOCs.Add(grfSndPOCs);  
 
                rdSndPOCs.PageSize = 30;  
                rdSndPOCs.AllowPaging = true;  
                rdSndPOCs.AllowSorting = true;  
                rdSndPOCs.GridLines = GridLines.None;  
                rdSndPOCs.PagerStyle.Mode = GridPagerMode.NumericPages;  
 
                rdSndPOCs.AutoGenerateColumns = false;  
 
                gbcID = new GridBoundColumn();  
                GridBoundColumn gbcSecondaryPOC = new GridBoundColumn();  
 
                gbcID.DataField = "ID";  
                gbcID.HeaderText = "Document ID";  
                gbcID.Visible = true;  
 
                gbcSecondaryPOC.DataField = "SecondaryPOC";  
                gbcSecondaryPOC.HeaderText = "Secondary POC";  
 
                rdSndPOCs.Columns.Add(gbcID);  
                rdSndPOCs.Columns.Add(gbcSecondaryPOC);  
 
                rdSndPOCs.Width = Unit.Percentage(95);  
                rdSndPOCs.DataSource = ds.Tables[1];  
                rdSndPOCs.DataBind();  
 
                rdDocs.MasterTableView.DetailTables.Add(rdSndPOCs);  
                 
            }  
            catch (Exception ex)  
            {  
                Context.Response.Write(ex.Message);  
            }  
        }  
 
 void rdDocs_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e)  
            {  
                string str = "";  
            }  
 
            void rdDocs_ItemDataBound(object sender, GridItemEventArgs e)  
            {  
                strTest += e.Item.ItemIndex + "<br>";  
            }  
 
            void rdDocs_ItemCommand(object source, GridCommandEventArgs e)  
            {  
                //throw new NotImplementedException();  
                if (e.CommandName == "ExpandCollapse")  
                {  
                    DataTable dt = (DataTable)e.Item.OwnerTableView.DataSource;  
                    if ((dt != null) && (dt.TableName == "DocTable"))  
                    {  
                        GridTableView detailView = (e.Item as GridDataItem).ChildItem.NestedTableViews[1];  
                        detailView.Visible = false;  
                    }  
                }  
            } 

The link between the two tables (Tables are named "DocTable" and "SPOCTable") is the column "ID".  When this control is displayed on the page, the first table shows up fine.  The second table however, doesnt show up at all.  The hierarchal demo is really cool and useful for what we want but I just do not understand what is going on.

J
J
Top achievements
Rank 1
 answered on 13 Jan 2010
2 answers
132 views
Hello,

I need to set ClickToOpen behavior on Server Side. RadMenuItem doesn't have corresponding property. How can I do this?

Thank you
virt
Top achievements
Rank 1
 answered on 13 Jan 2010
2 answers
146 views
Hi all:

I have an ASP.NET application with several RadGrids on it displaying data, as well as some other text and images. All of the content is contained within an ASP.NET Ajax tabcontainer. The end user wants the ability to export all of the data to a PDF file, so I thought it might be a good idea to put a RadEditor on another tab, and have all of the data from the application added to the RadEditor content area, and then when the end user is ready they can make any needed changes in the RadEditor, and then use the ExportToPDF function to get the PDF.

However, I have been unable to get the data from the RadGrids into the RadEditor, can anyone give me some insight as to how I can accomplish this? I tried this:

public string RenderControl(Control ctrl)

  {

    StringBuilder sb = new StringBuilder();

    StringWriter tw = new StringWriter(sb);

    HtmlTextWriter hw = new HtmlTextWriter(tw);

 

    ctrl.RenderControl(hw);

    return sb.ToString();

  }

protected void Button1_Click1(object sender, EventArgs e)

  {

    RadEditor1.Content += RenderControl(RadGrid1);
    RadEditor1.ExportToPdf();
  }

But I got some kind of script error:

Script control 'RadGrid1' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
Parameter name: scriptControl

Any and all input is greatly appreciated.

John.

John
Top achievements
Rank 1
 answered on 13 Jan 2010
5 answers
115 views
Hi,

All my nodes are set to serverside callback. I get the following error intermittently when I drop a node onto another:  'this._backupExpandedNodes[...]' is null or not an object

function insertOver(destinationNode, sourceNode)
{
    var allnodes = destinationNode.get_nodes();
    allnodes.add(sourceNode);
 }

I've copied the drag and drop functionality from the samples. But added this function so that I can sort the nodes afterwards.

it's the allnodes.add(sourceNode); line which causes the error. Stack trace:

Telerik.Web.UI.ControlItemCollection.prototype={add:function(_ef){
var _f0=this._array.length;
this.insert(_f0,_ef);
},insert:function(_f1,_f2){
var _f3=_f2.get_parent();
var _f4=this._parent._getControl();
if(_f3){
_f3._getChildren().remove(_f2);
}
 calls:
Telerik.Web.UI.ControlItemCollection.prototype={add:function(_ef){
var _f0=this._array.length;
this.insert(_f0,_ef);
},insert:function(_f1,_f2){
var _f3=_f2.get_parent();
var _f4=this._parent._getControl();
if(_f3){
_f3._getChildren().remove(_f2);
}
if(_f4){
_f4._childInserting(_f1,_f2,this._parent);
}
Array.insert(this._array,_f1,_f2);
_f2.set_parent(this._parent);
if(_f4){
_f4._childInserted(_f1,_f2,this._parent);
_f4._logInserted(_f2);
}
calls:
childInserted:function(_1f8,node,_1fa){
if(!_1fa._childControlsCreated){
return;
}
this._restoreClientState();
if(this._threeState){
node._updateParentCheckState(this);
}
calls:
backupClientState:function(){
this._backupCollapsedNodes=this._getCollapsedNodes();
this._backupExpandedNodes=this._getExpandedNodes();
this._backupSelectedNodes=this.get_selectedNodes();
this._backupCheckedNodes=this.get_checkedNodes();
},_restoreClientState:function(){
this._clientState.selectedNodes=[];
for(var i=0;i<this._backupSelectedNodes.length;i++){
Array.add(this._clientState.selectedNodes,this._backupSelectedNodes[i]._getHierarchicalIndex());
}
this._clientState.collapsedNodes=[];
for(var i=0;i<this._backupCollapsedNodes.length;i++){
Array.add(this._clientState.collapsedNodes,this._backupCollapsedNodes[i]._getHierarchicalIndex());
}
this._clientState.expandedNodes=[];
for(var i=0;i<this._backupExpandedNodes.length;i++){
Array.add(this._clientState.expandedNodes,this._backupExpandedNodes[i]._getHierarchicalIndex());
}
this._clientState.checkedNodes=[];
for(var i=0;i<this._backupCheckedNodes.length;i++){
Array.add(this._clientState.checkedNodes,this._backupCheckedNodes[i]._getHierarchicalIndex());
}


Jaffar Sadiq
Top achievements
Rank 1
 answered on 13 Jan 2010
2 answers
108 views
I've a DIV control with an HtmlImage control inside dinamically generated by setting the src to a  an aspx page producing a Bitmap as

Response.OutputStream

.
Each time I press the btnVisualizza_MG button the image must be updated. The button is enclosed in a RadAjaxManager as triggering control of the div. This is a brief extract of the code.

 

<

 

telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">

 

 

 

 

 

    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="btnVisualizza_MG">

 

 

 

 

            <

 

UpdatedControls>

 

 

 

 

 

                <telerik:AjaxUpdatedControl ControlID="divDisegnoModificaDisegno" LoadingPanelID="lp1" />  

 

 

            </UpdatedControls>

 

 

 

 

 

        </telerik:AjaxSetting>

 

 

 

    <AjaxSettings>
</telerik:RadAjaxManagerProxy >

protected

 

void btnVisualizza_MG_Click(object sender, EventArgs e)

 

{

    divDisegnoModificaDisegno.Controls.Clear();

    System.Web.UI.HtmlControls.

HtmlImage image = new System.Web.UI.HtmlControls.HtmlImage();

 

    image.Src =

"DrawGeometriaSistema.aspx?dim_x=640&dim_y=609";

 

    divDisegnoModificaDisegno.Controls.Add(image);

}

THE PROBLEM: the first time I press the btnVisualizza_MG button, the DrawGeometriaSistema.aspx page is called and the image is generated but the following times the image remains unchanged since the code, when reaching "image.Scr=..." instruction, does not call the DrawGeometriaSistema.aspx page.

Why and how to solve this problem? 

Marco Miccini
Top achievements
Rank 1
 answered on 13 Jan 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?