Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
95 views
I'm having a problem with changing the headertext in my detailtable..
I'm creating multiple grids by a loop and show the underneath eachother..
Because the columns in my detailtable are variable, I didn't bound them..

So is there a way to change the headertext?

RadGrid[] GridName = new RadGrid[intTotalProcessTemplates];
  
        
            for (int i = 0; i < intTotalProcessTemplates; ++i)
            {
                // Create mastertable
                GridName[i] = new RadGrid();
                GridName[i].DataSource = GetDataTable("SELECT * FROM ProcessTemplate WHERE ProcessTemplate_id = " + (i + 1));
                GridName[i].MasterTableView.DataKeyNames = new string[] { "ProcessTemplate_id" };
                GridName[i].Skin = "Black";
                GridName[i].AutoGenerateColumns = false;
                GridName[i].AllowPaging = true;
  
                // Columns create
                GridName[i].MasterTableView.Columns.Add(CreateGridColumn("Process name", "Name", 10.0));
                GridName[i].MasterTableView.Columns.Add(CreateGridColumn("Process description", "Description", 80.0));
                GridName[i].MasterTableView.Columns.Add(CreateGridColumn("Parent", "Parent", 10.0));
  
                // Create detail table
                GridTableView tableViewStartProcesses = new GridTableView(GridName[i]);
                tableViewStartProcesses.DataKeyNames = new string[] { "Process_id" };
                tableViewStartProcesses.AutoGenerateColumns = true;
                tableViewStartProcesses.AllowPaging = true;
                tableViewStartProcesses.CommandItemDisplay = GridCommandItemDisplay.Top;
  
                foreach (GridColumn col in tableViewStartProcesses.RenderColumn)
                {
                    if (col.UniqueName == "templateid")
                    {
                        col.HeaderText = "Template id";
                    }
                }
  
                // Fix result from stored proc: GetAllProcessesAndSteps_SP
                LinqResult(tableViewStartProcesses, i);
  
                // Add Details to table
                GridName[i].MasterTableView.DetailTables.Add(tableViewStartProcesses);;
  
                // Add to placeholder
                this.StartProcessPlaceHolder.Controls.Add(GridName[i]);
Daniel
Telerik team
 answered on 20 Jul 2011
3 answers
74 views
hi community,

does anybody know how to update stylesheets within head-tag per ajax?

thank you for your help
bernhard
Kiara
Top achievements
Rank 1
 answered on 20 Jul 2011
1 answer
102 views
So I am using RadGrid and Client-side binding. And i am really surprise how badly it sucks. First of you you need to hack almost each column type to "GridTemplateColumn" to create Hyperlinks Columns and format data. But then you can't do the hack to export (Call the server and bind it at serverside... so stupid) it because you cant use "GridTemplateColumn" in exporting. So you are stuck with the raw data when you want to export. HOW USELESS.

Then I try to SaveSettings on the grid. AND GUEST WHAT. doenst work client side. It needs a post back and then it break the client side binding.

I almost were a Telerik "profit" but with the last week experience I feel telerik is the fast server side solution and NOT client side. Waist of time if you want to do client side.
Radoslav
Telerik team
 answered on 20 Jul 2011
7 answers
108 views
Hi,

 Iam using radscheduler version 2010 Q2, There is any possibilty to show Reminders for an appoientment even we are  not in scheduler page. i.e Display Reminder when we are in any page of Website  



Thanks 
Sanker 
Peter
Telerik team
 answered on 20 Jul 2011
4 answers
111 views
Hi Telerik,

Could you please clarify if this is expected behavior?

I am programatically setting the ForbiddenZones property of every dock on my page. I do so like this:

/// <summary>
/// Shows where docks can/can't be moved. Forbidden zones are all DockZone's with Docks.
/// </summary>
private void SynchForbiddenZones(RadDockLayout dockLayout)
{
    Logger.Info("Synching forbidden zones");
    IEnumerable<CormantRadDock> docks = dockLayout.RegisteredDocks.OfType<CormantRadDock>();
 
    foreach (CormantRadDock dock in docks)
    {
        List<string> forbiddenZones = new List<string>();
        foreach (CormantRadDock otherDock in docks.Where(otherDock => otherDock != dock && !otherDock.GetState().Closed))
        {
            forbiddenZones.Add(otherDock.DockZoneID);
            forbiddenZones.Add(otherDock.DockZoneID.Replace("RadDockZone_", "")); //Why is this necessary?
        }
        dock.ForbiddenZones = forbiddenZones.ToArray();
    }
}

I have found that there is a discrepancy between how Telerik's Client and Server code interpret ForbiddenZones. 

If I leave my forbidden zones as just "DockZoneID" then this code works fine:

function OnClientDragStart(dock) {
    var forbiddenZones = dock.get_forbiddenZones();
    for (var zoneId in forbiddenZones) {
        var zone = $find(forbiddenZones[zoneId]);
        if (zone != null) {
            var zoneElement = zone.get_element();
            Sys.UI.DomElement.addCssClass(zoneElement, "zoneDropNotOk");
        }
    }
}
 
function OnClientDragEnd(dock) {
    var forbiddenZones = dock.get_forbiddenZones();
 
    for (var zoneId in forbiddenZones) {
        var zone = $find(forbiddenZones[zoneId]);
        if (zone != null) {
            var zoneElement = zone.get_element();
            Sys.UI.DomElement.removeCssClass(zoneElement, "zoneDropNotOk");
        }
    }
}

but when I drag a dock onto an already populated dock zone, even though the zone glows red, I am still able to drop the dock onto the dock zone.

Yet, observe that if I strip of the "RadDockZone_" header -- thus making it the DockZone's UniqueName -- now the dock is unable to dock onto the dockzone in question. 

Yet, observe that if I only add the DockZone's UniqueName property to the dock's ForbiddenZone array that the above JavaScript stops functioning.

The client side appears to care about the ID of the zone, the server side cares about the UniqueName. If this is intended, why? It is a hassle to comment why I am storing two values when only one is necessary to determine uniqueness.
Pero
Telerik team
 answered on 20 Jul 2011
5 answers
201 views

Requirements

RadControls 2010.3.1317.35version

.NET version 3.5

Visual Studio version 2010

programming language C#

browser support

all browsers supported by RadControls


PROJECT DESCRIPTION
This project demonstrates how to handle ASP.NET Form Validation with the RadAjaxManager when fired from the onkeypress event from a textbox and perform an async postback if the validation succeeded.

<head runat="server">
    <title></title>
    <telerik:RadCodeBlock runat="server" ID="radCodeBlock">
        <script type="text/javascript">
            function CheckEnterKey(sender, args) {
                var keyCode = args.get_keyCode();
                if (keyCode == 13) {
                    Page_ClientValidate("Search");
                    if (Page_IsValid) {
                        var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
                        ajaxManager.ajaxRequestWithTarget('<%= btnSearch.UniqueID %>', '');
                    }
                }
            }
        </script>
    </telerik:RadCodeBlock>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="radScriptMgr">
    </telerik:RadScriptManager>
    <telerik:RadInputManager ID="RadInputManager1"  runat="server">       
        <telerik:RegExpTextBoxSetting BehaviorID="Setting3" EmptyMessage="Enter Zip Code" ClientEvents-OnKeyPress="CheckEnterKey"
            ValidationExpression="\d{5}(-\d{4})?" ErrorMessage="Invalid Zip Code" Validation-IsRequired="true" Validation-ValidationGroup="Search">
                <TargetControls>
                    <telerik:TargetInput ControlID="txtZipCode" />
                </TargetControls>
            </telerik:RegExpTextBoxSetting
    </telerik:RadInputManager>
    <telerik:RadAjaxLoadingPanel Skin="Default" runat="server" ID="pnlLoadingPanel">
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="btnSearch">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="pnlSearch" LoadingPanelID="pnlLoadingPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <div style="text-align: center; margin: 0 auto;">
     <asp:TextBox ID="txtZipCode" ValidationGroup="Search" runat="server" MaxLength="5" Width="133px" Height="20px"></asp:TextBox>
      <telerik:RadButton runat="server" ID="btnSearch" Text="Search" ValidationGroup="Search">
       <Icon PrimaryIconCssClass="rbSearch" PrimaryIconLeft="4" PrimaryIconTop="4" />
      </telerik:RadButton>      
        <br /><br />
        <asp:Panel ID="pnlSearch" Height="100%" DefaultButton="btnSearch" Width="100%" runat="server">
            <asp:Literal ID="litTimeOfSearch" runat="server"></asp:Literal><br /><br /><br /><br />
        </asp:Panel>
    </div>
    </form>
</body>
</html>

After this you can use some event handling to perform the necessary action postback.

protected void Page_Load(object sender, EventArgs e)
 {
 
     this.btnSearch.Click += new EventHandler(btnSearch_Click);
 
 }
 
 void btnSearch_Click(object sender, EventArgs e)
 {
     Thread.Sleep(2000);
     litTimeOfSearch.Text = string.Format("<b>Last Search Executed at</b>: {0} <br/> <b>Zip code </b> : {1}",  DateTime.Now.ToShortTimeString()
         ,txtZipCode.Text);
 }
Iana Tsolova
Telerik team
 answered on 20 Jul 2011
2 answers
105 views
I have sql table like below.I want to show it in tree view


id   parentid     name
1     NULL       outlook
2     1      overcast
3     1       rainy
4     1       sunny
5     2        yes
6     3        wind
7     4      humidity
8     6       strong
9     6        weak
10    7        high
11    8         no
12    9         yes
13   10          no
14   15         yes
15   7        normal
please help me if any one knows.....
dhanya
Top achievements
Rank 1
 answered on 20 Jul 2011
0 answers
82 views
Hello,

I have a radgrid that i want to display images inside one of its columns

the XML file looks like this where home.jpg and home1.jpg are stored in a folder and they represent the name of the image
<?xml version="1.0" encoding="utf-8" ?>
<Files>
    <item ID="1">
        <filename>home.jpg</filename>
    </item>
  
  <item ID="2">
    <filename>home1.jpg</filename>
  </item>
  
</Files>

Thanks a lot for your help
Mike
Mike_T
Top achievements
Rank 1
 asked on 20 Jul 2011
0 answers
188 views
Hi,

I'm testing RadGrid filters and I have problems with template filters.

I want to have a template filter for a column binded to a datetime datafield, for filtering between two dates. The template has these controls:
    - a Date picker for start date.
    - a Date picker for end date.
    - a button to apply/clear the filter.

These are pieces of the code I'm using:

- ASPX:
...
    <telerik:GridBoundColumn DataField="DateTimeFieldDB"
        DataType="System.DateTime"
        FilterControlAltText="Filter DateTimeFieldDB column"
        HeaderText="Date/Time" SortExpression="DateTimeFieldDB"
        UniqueName="DateTimeCol" HeaderButtonType="LinkButton">
        <HeaderStyle Width="150px" />
                    <FilterTemplate>
                        <telerik:RadDatePicker ID="FromDT" runat="server" Width="70px"/>
                        <telerik:RadDatePicker ID="ToDT" runat="server" Width="70px"/>
                        <telerik:RadButton ID="btnFilterDT" runat="server" Text="Filter" CommandName="cmdFilterDT">
                        </telerik:RadButton>
                    </FilterTemplate>
    </telerik:GridBoundColumn>
...


- CS:
protected void myGrid_ItemCommand(object sender, GridCommandEventArgs e)
 {
     switch (e.CommandName)
     {
         case "cmdFilterDT":
             GridColumn column = myGrid.MasterTableView.GetColumnSafe("DateTimeCol");
 
             GridItem[] fItems = myGrid.MasterTableView.GetItems(GridItemType.FilteringItem);
             RadDatePicker dpFrom = (RadDatePicker)fItems[0].FindControl("FromDT");
             RadDatePicker dpTo = (RadDatePicker)fItems[0].FindControl("ToDT");
             string sDateFrom = string.Format("{0: dd/MM/yyyy}", dpFrom.SelectedDate);
             string sDateTo = string.Format("{0: dd/MM/yyyy}", dpTo.SelectedDate);
 
             if (dpFrom.SelectedDate.ToString() != string.Empty && dpTo.SelectedDate.ToString() != string.Empty)
             {
                 column.CurrentFilterFunction = GridKnownFunction.Between;
                 column.CurrentFilterValue = string.Format("{0} {1}", sDateFrom, sDateTo);
             }
             else
             {
                 column.CurrentFilterFunction = GridKnownFunction.NoFilter;
                 column.CurrentFilterValue = "";
             }
 
             myGrid.MasterTableView.Rebind();
             break;
     }
 }


When I click the filter button the command is fired and the code for 'cmdFilterDT' is executed, but no changes are displayed in the grid (I have a rule from myGrid to myGrid in an RadAjaxManager for refreshing the changes).

Anyone can help me? I've been reading the help and the grid forum but I don't find any solution to this method for using template filters.

Thanks in advance,
John.



john
Top achievements
Rank 1
 asked on 20 Jul 2011
5 answers
130 views
It would be nice to have context menu on the columns of the grid that define which columns display (like windows explorer does). 

Does the RadGrid support this or does anybody know a way this can be easily done?
Sebastian
Telerik team
 answered on 20 Jul 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?