Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
106 views
Hello,

I have downloaded the update through visual studio, but I still dont have the "RadNotification" control in my toolbox. Also it's not recognized through code. Could you please explain how I can get this control? I have the RadControls for ASP.NET AJAX (.NET 3.5).

Thanks!
Marin Bratanov
Telerik team
 answered on 26 Sep 2011
1 answer
165 views
Hai,

I have a RadDatePicker. I want the current date to be highlighed in the datepicker. I understood from your support site that the current date will be highlighted by default.  It is not showing the current date highlighted. Plz help
Shinu
Top achievements
Rank 2
 answered on 26 Sep 2011
2 answers
137 views
The problem I'm having is if you have over the Level 1c and then Level 1b the submenu grows in width.  The attached images may help to explain better what is happening.

|  Level 1     Level 1a     Level 1b    Level 1c    Level 1d  |
|            Sublevel 1a1  Sublevel 1a2  Sublevel 1a3                     |  width excedes
Prathap
Top achievements
Rank 1
 answered on 26 Sep 2011
1 answer
54 views
Hi all,

I am having some issues with the RadAjaxPanel when using it to develop Webparts for Sharepoint 2010.
I have a RadGrid inside a RadAjaxPanel.
When i do a filter or a paging, i have a fullpostback on the first time then everything works as expected (no postback the second time).
This first time postback is causing me a lot of problems.
Please can you help me with this issue? It is an urgent matter.

Thank you in advance.

Fady Raad.

P.S: if any code snippets is required please inform me.
Maria Ilieva
Telerik team
 answered on 26 Sep 2011
1 answer
254 views
I have two GridTemplateColumn's inside a RadGrid that is created dynamically in the code behind (there are actually several Grids, all with different datasources, that live inside the child items of a 2-level deep RadPanelBar!). It's a fairly simple senario:

1st column is a "N/A" column that only contains a RadioButton control.
2nd column is a "Date" column that contains a RadioButton and a RadDatePicker.

The desired behavior is for the RadDatePicker to be disabled when the "N/A" button is pressed, and enabled when the "Date" button is pressed. Unfortunately there's no 'onChanged' event for RadioButtons, so it has to be handled by 'onClick' handlers.

Here are template classes for the two columns:

private class RadioButtonDateColumnTemplate : ITemplate
{
    protected RadioButton rButton;
    protected RadDatePicker datePicker;
    private string colname;
    public RadioButtonDateColumnTemplate(string cName)
    {
        colname = cName;
    }
    public void InstantiateIn(System.Web.UI.Control container)
    {
        rButton = new RadioButton();
        rButton.GroupName = "ScaleButtons";
        rButton.ID = "dateButton";
        rButton.DataBinding += new EventHandler(rButton_DataBinding);               
         
        datePicker = new RadDatePicker();
        datePicker.ID = "DatePicker";
        datePicker.DataBinding += new EventHandler(datePicker_DataBinding);
        datePicker.Load += new EventHandler(datePicker_Load);
 
        container.Controls.Add(rButton);
        container.Controls.Add(datePicker);
    }
 
    void datePicker_Load(object sender, EventArgs e)
    {
        rButton.Attributes.Add("onClick", string.Format("DateButtonClicked('{0}')", datePicker.ClientID));
    }
 
    void datePicker_DataBinding(object sender, EventArgs e)
    {
        RadDatePicker dPick = (RadDatePicker)sender;
        GridDataItem container = (GridDataItem)dPick.NamingContainer;
 
        string date = ((DataRowView)container.DataItem)[colname].ToString();
        DateTime dateTime;
 
        if (date == string.Empty)
            dPick.SelectedDate = null;
        else
        {
            DateTime.TryParse(date, out dateTime);
            dPick.SelectedDate = dateTime;
        }
    }
 
    void rButton_DataBinding(object sender, EventArgs e)
    {
        RadioButton rBut = (RadioButton)sender;
        GridDataItem container = (GridDataItem)rBut.NamingContainer;
 
        bool naChecked;
        bool.TryParse(((DataRowView)container.DataItem)["na"].ToString(), out naChecked);
        rButton.Checked = !naChecked;
        datePicker.Enabled = !naChecked;
    }
}


private class RadioButtonColumnTemplate : ITemplate
{
    protected RadioButton rButton;
    private string colname;
    public RadioButtonColumnTemplate(string cName)
    {
        colname = cName;
    }
    public void InstantiateIn(System.Web.UI.Control container)
    {
        rButton = new RadioButton();
        rButton.GroupName = "ScaleButtons";
        rButton.DataBinding += new EventHandler(rButton_DataBinding);
        if (colname == "na")
        {
            rButton.ID = "naButton";
            rButton.Load += new EventHandler(rButton_Load);
        }
 
        container.Controls.Add(rButton);
    }
 
    void rButton_Load(object sender, EventArgs e)
    {
        GridDataItem gridRow = (GridDataItem)rButton.Parent.NamingContainer;
        string gridID = gridRow.OwnerGridID;
        int rowIndex = gridRow.DataSetIndex;
 
        rButton.Attributes.Add("onClick", string.Format("NaButtonClicked('{0}',{1},'Date')", gridID, rowIndex));
    }
 
    void rButton_DataBinding(object sender, EventArgs e)
    {
        RadioButton rBut = (RadioButton)sender;
        GridDataItem container = (GridDataItem)rBut.NamingContainer;
 
        bool check;
        bool.TryParse(((DataRowView)container.DataItem)[colname].ToString(), out check);
        rButton.Checked = check;
    }
}

The RadGrids are created inside a dynamically built RadPanelBar with root and child items (the RadGrids are inside the child items, 1 per child):

protected void CategoriesPanelBar_Init(object sender, EventArgs e)
{
    DataTable cTypes = GetCapabilityTypes(false);
    DataTable cCategories = GetCapabilityCategories();
 
    RadPanelBar rpbCapabilityCategories = (RadPanelBar)sender;
 
    foreach (DataRow typeRow in cTypes.Rows)
    {
        string typeName = typeRow["typename"].ToString();
        string typeID = typeRow["id"].ToString();
        RadPanelItem typeItem = new RadPanelItem(typeName);
        DataRow[] categoriesByType = cCategories.Select(string.Format("type = {0}", typeID));
        foreach (DataRow categoryRow in categoriesByType)
        {
            string categoryName = categoryRow["categoryname"].ToString();
            int categoryID = int.Parse(categoryRow["id"].ToString());
            RadPanelItem categoryItem = new RadPanelItem(categoryName);
            categoryItem.BackColor = System.Drawing.Color.LightBlue;
 
            RadGrid rgItems = new RadGrid();
            rgItems.AutoGenerateColumns = false;
            rgItems.AllowMultiRowEdit = true;
            rgItems.MasterTableView.EditMode = GridEditMode.InPlace;
            rgItems.PreRender += new EventHandler(rgItems_PreRender);
 
            BuildCapabilityItemsGridByCategory(rgItems, categoryID);
 
            categoryItem.Controls.Add(rgItems);
            typeItem.Items.Add(categoryItem);
        }
 
        rpbCapabilityCategories.Items.Add(typeItem);
    }
}


I create the template columns when building the RadGrid inside the BuildCapabilityItemsGridByCategory() function:

...

DataTable dtCapabilities = GetCapabilityItemsByCategoryAndSite(category, site);
 
...
 
dtCapabilities.Columns.Add("na", System.Type.GetType("System.Boolean"));
GridTemplateColumn naCol = new GridTemplateColumn();
naCol.ItemTemplate = new RadioButtonColumnTemplate("na");
naCol.HeaderText = "N/A    ";
naCol.DataField = "na";
rgItems.Columns.Insert(rgItems.Columns.Count, naCol);
 
...
 
GridTemplateColumn dateCol = new GridTemplateColumn();                       
dateCol.ItemTemplate = new RadioButtonDateColumnTemplate("date");
dateCol.HeaderText = "Date";
dateCol.DataField = "date";
dateCol.UniqueName = "Date";
rgItems.Columns.Insert(rgItems.Columns.Count, dateCol);
 
...
 
rgItems.DataSource = dtCapabilities;
rgItems.DataBind();


Now enabling the RadDatePicker was very easy - I can pass the clientID directly to the JavaScript function, so a simple js function works:

function DateButtonClicked(datePickerId) {
         var datePicker = $find(datePickerId)
         datePicker.set_enabled(true);
}

But I had a terrible time trying to get the disable to work!! At first, I tried passing the RadDatePicker clienID to the JavaScript function by getting it in the code behind (which is easier for me to write than JavaScript). I tried getting the "N/A" buttton's GridDataItem and looking for a RadDatePicker control on the same row, but some some reason the event would NEVER show up in the page's markup, even when I could see the attribute being added with what appear to be the correct clientID's for the "N/A" radio button and the RadDatePicker on the same row.

I followed some other examples to create a very round-about solution, passing the entire GridView to the JavaScript function, along with the row index and column name that holds the RadDatePicker I want to disable. Even then, I'm not sure how to access the RadDatePicker directly from its grid cell. I ended up using an ugly hack to parse the clientID out of the .innerHTML of the cell, then using the $find() method to grab it. It works, but I KNOW there has to be a better, safer way of doing this:

function NaButtonClicked(gridID, index, colName) {
   var gridView = $find(gridID);
   var masterTable = gridView.get_masterTableView();
   var cell = masterTable.getCellByColumnUniqueName(masterTable.get_dataItems()[index], colName)
   if (cell != null) {
      var datePickers = cell.getElementsByClassName('RadPicker RadPicker_Default');
      for (i = 0; i < datePickers.length; i++) {
         var idString = datePickers[i].innerHTML;
         var startString = "id=\"";
         var endString = "\"";
         var startIndex = idString.indexOf(startString) + startString.length;
         var endIndex = idString.indexOf(endString, startIndex);
         var datePickerId = idString.substring(startIndex, endIndex);
      }
   }
   var datePicker = $find(datePickerId)
   datePicker.set_enabled(false);
}


My questions are:
- is there an easier way to access the controls living in these template columns? I don't have an easy references to use, because everything is created dynamically (the RadGrid, the columns, etc)
-am I hooking up the JavaScript functions is the right spot in the code behind?

I'm worried I'm going about this in the wrong way, making things unnecessarily hard on myself, but maybe the programmatic approach I'm using is just more difficult to execute. I'm very new to ASP.NET and especially JavaScript coding, so I appreciate any help (and all the help I've already received from Pavlina!).


Thanks,
-Adam
Pavlina
Telerik team
 answered on 26 Sep 2011
1 answer
80 views
http://www.telerik.com/help/aspnet-ajax/grid-filtertemplate.html

Is there a replacement for Checkbox for RadComboBoxSelectedIndexChangedEventArgs?
When I tried the client code version, args is undefined.

<script type="text/javascript">
    function chkFilter_CheckedChanged(sender, args) {
        var tableView = $find("<%# TryCast(Container, GridItem).OwnerTableView.ClientID %>");
        tableView.filter("column", args.get_item().get_value(), "EqualTo");
    }
</script>
Radoslav
Telerik team
 answered on 26 Sep 2011
1 answer
44 views

How to solve change the radgrid default tool tip when site has mutiple langaues?
For example, when french user look at the grid, they want to see tool tip"sort" word in french.

I tried Mygrid.Culture =

 

new System.Globalization.CultureInfo("fr-fr"); it doesn't work.

 

Shinu
Top achievements
Rank 2
 answered on 26 Sep 2011
3 answers
120 views
I have a tooltip that I am using to preview text on all of a customers items in one spot. When an item is added or modified it calls a function that builds the basic html content for the tooltip, like so...(some lines omitted for clarity)

var divReviewAllPers = getElementId('divReviewAllPers');
for
(i = 1; i < arrItems.length; i++) {
            strAllPersText += '<u>Item #' + i + '</u><br />';
            if (i == parseInt(hidItemEdit.value)) {
                // This is the item being edited, so update the master string with the textbox values
                var strNewPersTextItem = '';
                var strItemLines = arrItems[i];
                
                for (x = 0; x < arrLines.length; x++) {
                    if (x < getElementId('hidNumLines').value) {
                        if (strLine == '') {
                            strAllPersText += 'Line ' + (x + 1) + ' - [LINE IS BLANK]<br />';
                        } else {
                            strAllPersText += 'Line ' + (x + 1) + ' - ' + strLine + '<br />';
                        }
                    }
                    strNewPersTextItem += 'Line ' + (x + 1) + ' - [LINE IS BLANK]<br />';
                }
            } else {
                // This is not the item being edited, so put the existing data back in the master string
                if (arrItems[i].length > 0) {
                    for (y = 0; y < arrLines.length; y++) {
                        if (y < getElementId('hidNumLines').value) {
                            if (arrLines[y] == '') {
                                strAllPersText += 'Line ' + (y + 1) + ' - [LINE IS BLANK]<br />';
                            } else {
                                strAllPersText += 'Line ' + (y + 1) + ' - ' + arrLines[y] + '<br />';
                            }
                        }
                    }
                }
            }
        }
         
        if (intMode == 1) {
            strNewPersTextItem = '<u>Item #' + i + '</u><br />' + strNewPersTextItem;
            divReviewAllPers.innerHTML = strAllPersText + strNewPersTextItem;
            divReviewAllPers2.innerHTML = strAllPersText + strNewPersTextItem;
        } else {
            divReviewAllPers.innerHTML = strAllPersText;
            divReviewAllPers2.innerHTML = strAllPersText;
        }

Now, this all works fine and dandy in FF, but in IE there's a glitch. It appears to only display the content that was there the FIRST time the tooltip was activated. Once you look at the tooltip once, the content doesnt change. When tracing thru the code, I can clearly see the new content in divReviewAllPers.innerHTML, but it doesnt appear when I trigger the tooltip.
Another twist to this is that in IE, the content DOES update if you're updating a line that was there the first time you looked at the tooltip. ie: item 1, line 1 gets updated to say "test"..."test" will show in the dropdown, but the other items that were added & edited after the first tooltip activation still do not appear. Spooky??

Here is my tooltip html...
<center>
                                    <a href="#" id="lnkReviewAllPers" class="link-color">Click here to review all personalization text</a>
                                    </center>
                                    <rad:RadToolTip ID="RadToolTip7" Skin="Default" runat="server" TargetControlID="lnkReviewAllPers" ShowEvent="OnClick"
                                        IsClientID="true" RelativeTo="Element" Position="BottomCenter" Width="400px" Height="225px" Animation="Fade" ManualClose="true">
                                        <div id="divReviewAllPers" style="height:215px; overflow:auto;"></div>
                                    </rad:RadToolTip>

In the attached screenshot, you can see item #5 has been added, but it does not appear in the tooltip. Can someone advise why this might not be updating in IE?
Marin Bratanov
Telerik team
 answered on 26 Sep 2011
1 answer
53 views
On the demo page http://demos.telerik.com/aspnet-ajax/listview/examples/dataediting/manualediting/defaultcs.aspx the add button for the second listview should read "Add New Customer" not "Add New Product".

Regards

ROSCO
Mira
Telerik team
 answered on 26 Sep 2011
3 answers
103 views
Hi all,
Here http://demos.telerik.com/aspnet-ajax/treeview/examples/programming/databindings/defaultcs.aspx I've read that I can bind different tables from data set to different levels. But I didn't found example with it and all my attempts failed.
My Db scheme: Category -> Item.
I want to show tree view like:

 cat1
 - item 1
 - item 2
 - item 3
 cat2
 - item 4

Right now I bind tree view from server side manually, but I want to use for example ObjectDataSource or SqlDataSource instead.

Plamen
Telerik team
 answered on 26 Sep 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?