Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
250 views
Hello everyone,

I am running into a RadGrid and binding the datasource for it programmatically, one of the columns should be a dropdown list so when I am in edit mode it would query a table and show options to choose from
                          <radG:GridTemplateColumn DataField="DepName" HeaderText="DepName" UniqueName="DepName">  
                                <ItemTemplate> 
                                    <asp:DropDownList ID="lblDep" runat="server" Enabled="false" /> 
                                </ItemTemplate> 
                                <EditItemTemplate> 
                                    <asp:DropDownList ID="DepNameddl" runat="server" /> 
                                </EditItemTemplate> 
                          </radG:GridTemplateColumn> 
 
 And here is the ItemDataBound that I can't seem to get to work;
    Protected Sub rgPersonAdmin_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.WebControls.GridItemEventArgs) Handles rgPersonAdmin.ItemDataBound  
        If TypeOf e.Item Is GridDataItem Then 
            Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)  
            Dim strChk As String = item.GetDataKeyValue("PersonIndic").ToString()  
            Dim chkbx As CheckBox = DirectCast(item("PersonIndic").FindControl("cbPersonIndic"), CheckBox)  
            If strChk = "1" Then 
                chkbx.Checked = True 
            Else 
                chkbx.Checked = False 
            End If 
 
            'dropdownlist  
            Dim ddl As DropDownList = DirectCast(item("DepName").FindControl("lblDep"), DropDownList)  
            Dim getDS As New DataSet  
            getDS = dataConn.PhoneGetDepDDL()  
            ddl.DataSource = getDS.Tables(0).DefaultView  
            ddl.DataTextField = "DepName" 
            ddl.DataValueField = "DepID" 
            ddl.DataBind()  
 
        End If 
    End Sub 
 
It works fine to bind the checkbox but it is not working for the dropdownlist.

I saw in other forms about the gridColumnDropDownList but I couldn't find a way to bind it programmatically; any help will be appreciated.

Thanks,
Shehab
Princy
Top achievements
Rank 2
 answered on 23 Jun 2008
5 answers
193 views
Hi I tried the sample code in for multiple comboxboxes.
My code is below. The problem is it does not load the 2nd boxes items.

This line:    LoadCountries(e.Text);

e.Text is always empty. Any ideas why?  That is why it's not loading up the next boxes items.



using System;
using System.Data;
using System.Data.OleDb;
using Telerik.WebControls;
using DBUtils;


    /// <summary>
    /// Summary description for _Default.
    /// </summary>
    public partial class DefaultCS : System.Web.UI.Page
    {




        private void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                LoadContinents();
            }
        }


        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }

        ///        Required method for Designer support - do not modify
        ///        the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.RadComboBox1.ItemsRequested += new Telerik.WebControls.RadComboBoxItemsRequestedEventHandler(this.RadComboBox1_ItemsRequested);
            this.RadComboBox2.ItemsRequested += new Telerik.WebControls.RadComboBoxItemsRequestedEventHandler(this.RadComboBox2_ItemsRequested);
            this.RadComboBox3.ItemsRequested += new Telerik.WebControls.RadComboBoxItemsRequestedEventHandler(this.RadComboBox3_ItemsRequested);
            this.Load += new System.EventHandler(this.Page_Load);

        }
        #endregion

        private void LoadContinents()
        {

            DataSet ds = DBHelper.GetRegionsForCombo();

            RadComboBox1.DataTextField = "Region";
            RadComboBox1.DataValueField = "Region";
            RadComboBox1.DataSource = ds;
            RadComboBox1.DataBind();

            foreach (RadComboBoxItem item in RadComboBox1.Items)
            {
                item.ToolTip = item.Text;
            }
        }

        private void LoadCountries(string region)
        {
            if (String.IsNullOrEmpty(region)) return;

            DataSet ds = DBHelper.GetPortsForCombo(region);

            RadComboBox2.DataTextField = "Port";
            RadComboBox2.DataValueField = "Port";
            RadComboBox2.DataSource = ds;
            RadComboBox2.DataBind();

            foreach (RadComboBoxItem item in RadComboBox2.Items)
            {
                item.ToolTip = item.Text;
            }
        }

        private void LoadCities(string port)
        {
            DataSet ds = DBHelper.GetFacilityForCombo(port);

            RadComboBox3.DataTextField = "Facility";
            RadComboBox3.DataValueField = "Facility";
            RadComboBox3.DataSource = ds;
            RadComboBox3.DataBind();

            foreach (RadComboBoxItem item in RadComboBox3.Items)
            {
                item.ToolTip = item.Text;
            }
        }

        private void RadComboBox1_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
        {
            LoadContinents();
        }

        private void RadComboBox2_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
        {
            LoadCountries(e.Text);
        }

        private void RadComboBox3_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
        {
            LoadCities(e.Text);
        }
    }

Veselin Vasilev
Telerik team
 answered on 23 Jun 2008
5 answers
588 views
For some reason I am unable to hide the drop down on the client. I'm using the following code:

Telerik.Web.UI.RadComboBox.ComboBoxes[0].hideDropDown(); 

I am able to show the drop down using .showDropDown() with no problem.

In Firefox 2 and 3, hiding it does nothing. There is no JavaScript error, it just ignores the function call.

In IE6 and IE7, I get a JavaScript error in your code. The error occurs inside the _setPosition function, on the line that looks like this:

_169.style[_16a]=_168;

There is definitely a combo box on the screen, and I am able to get a reference to it by using the array above. I proved that by calling get_id(), and it does return the ID of the combo box correctly.

What am I doing wrong? Thanks.


Phani
Top achievements
Rank 1
 answered on 23 Jun 2008
10 answers
280 views
When I put FormDecorator to my page, where I have RadGrid with CheckBoxColumn the checkboxes are making invisible.

Anyone one know why?
Tervel
Telerik team
 answered on 23 Jun 2008
2 answers
123 views

function

OnBirthDateSelected(sender, e)

{

var datePicker;

//if (pickerID == null)

{

datePicker = $find(

"radDatePicker");

var now=new Date();

var yearnow=now.getYear();

var monthnow = now.getMonth()+1;

var daynow = now.getDay();

var date = datePicker.GetDate();

var years = yearnow - date.getYear();

if(years < 0)

{

document.getElementById(

"tb_age").value = "NaN";

return;

}

if (monthnow < date.getMonth() && (date.getMonth() - monthnow) >= 6 )

years--;

document.getElementById(

"tb_age").value = years.toString();

}

}

The function that calculate age but date.getYear(); return me not 1940 only 40
How i can decide the problem.

Yoni Dagan
Top achievements
Rank 1
 answered on 23 Jun 2008
2 answers
210 views
RadEditor example

I have a problem with unwanted extra space appearing at the bottom of RadEditor.
The Editor is within an edit template within a RadGrid.
It initially loads without the extra space, then flickers and expands to add the space at the bottom.
A screenshot is shown on the image link above if you can see it.
The aspx is shown below.
I would be grateful for any advice about to stop this behaviour.

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False"

GridLines="None" Width="869px" Skin="Hay">

<MasterTableView DataKeyNames="addressID">

<NoRecordsTemplate>

No Records found

</NoRecordsTemplate>

<RowIndicatorColumn Visible="False">

<HeaderStyle Width="20px"></HeaderStyle>

</RowIndicatorColumn>

<ExpandCollapseColumn Visible="False" Resizable="False">

<HeaderStyle Width="20px"></HeaderStyle>

</ExpandCollapseColumn>

<Columns>

<telerik:GridBoundColumn DataField="addressid" HeaderText="addressid" UniqueName="addressid"

ReadOnly="True" Visible="False">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="shortcut" HeaderText="Shortcut"

UniqueName="shortcut" ReadOnly="True">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="shortaddress" HeaderText="Address"

ReadOnly="True" UniqueName="shortaddress">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="address" HeaderText="address"

UniqueName="address" ReadOnly="True" Visible="False">

</telerik:GridBoundColumn>

<telerik:GridTemplateColumn UniqueName="TemplateColumn" >

<EditItemTemplate>

<asp:LinkButton runat="server" CommandName="Update" Text="Update"></asp:LinkButton>

&nbsp;<asp:LinkButton runat="server" CausesValidation="false" CommandName="Cancel"

Text="Cancel"></asp:LinkButton>

<br />

Shortcut:

<asp:TextBox ID="txtShortcut" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "shortcut") %>'></asp:TextBox>

<br />

<telerik:RadEditor ID="Editor" runat="server" Height="200" Width="806px"

ToolsWidth="570px" HasPermission="true"

Editable="true" ImagesPaths="~/Img" ShowHtmlMode="false"

ShowSubmitCancelButtons="false" SaveInFile="false" Html='<%# DataBinder.Eval(Container.DataItem, "address") %>'

Skin="Outlook" EditModes="Design, Html" AutoResizeHeight="True">

<Tools>

<telerik:EditorToolGroup Tag="Formatting">

<telerik:EditorTool Name="Bold" />

<telerik:EditorTool Name="Italic" />

<telerik:EditorTool Name="Underline" />

<telerik:EditorTool Name="StrikeThrough" />

<telerik:EditorTool Name="Subscript" />

<telerik:EditorTool Name="Superscript" />

</telerik:EditorToolGroup>

<telerik:EditorToolGroup Tag="Cutpaste">

<telerik:EditorTool Name="Cut" />

<telerik:EditorTool Name="Paste" />

<telerik:EditorTool Name="PastePlainText" />

<telerik:EditorTool Name="Undo" />

<telerik:EditorTool Name="Redo" />

</telerik:EditorToolGroup>

<telerik:EditorToolGroup Tag="Justify">

<telerik:EditorTool Name="JustifyLeft" />

<telerik:EditorTool Name="JustifyCenter" />

<telerik:EditorTool Name="JustifyRight" />

<telerik:EditorTool Name="JustifyFull" />

</telerik:EditorToolGroup>

<telerik:EditorToolGroup Tag="Indenting">

<telerik:EditorTool Name="Indent" />

<telerik:EditorTool Name="Outdent" />

<telerik:EditorTool Name="InsertUnorderedList" />

<telerik:EditorTool Name="InsertOrderedList" />

</telerik:EditorToolGroup>

<telerik:EditorToolGroup Tag="Tools">

<telerik:EditorTool Name="InsertTable" />

<telerik:EditorTool Name="InsertSymbol" />

<telerik:EditorTool Name="AjaxSpellCheck" />

<telerik:EditorTool Name="InsertSnippet" />

<telerik:EditorTool Name="ToggleScreenMode" />

<telerik:EditorTool Name="Help" />

</telerik:EditorToolGroup>

</Tools>

<Content>

</

Content>

</telerik:RadEditor>

</EditItemTemplate>

<ItemTemplate>

<asp:LinkButton runat="server" CausesValidation="false" CommandName="Edit" Text="Edit"></asp:LinkButton>

</ItemTemplate>

</telerik:GridTemplateColumn>

</Columns>

<EditFormSettings>

<PopUpSettings ScrollBars="None"></PopUpSettings>

</EditFormSettings>

<PagerTemplate>

shortcut

</PagerTemplate>

<CommandItemTemplate>

shortaddress

</CommandItemTemplate>

</MasterTableView>

</telerik:RadGrid>

Peter
Top achievements
Rank 1
 answered on 23 Jun 2008
2 answers
227 views
After migration to the ASP.NET AJAX my radopen call stopped working.

<script type="text/javascript">
function openResetPassword()
{
window.radopen(null, 'winPasswordReset'); 
}
</script>

Here is the window. It is located inside an UpdatePanel:

<telerik:RadWindowManager id="radwPasswords" runat="server" EnableTheming="true">
<Windows>
<telerik:RadWindow runat="server" ID="winPasswordReset" NavigateUrl="~/Forms/PasswordReset.aspx" Modal="true" Height="380px" Width="520px" Behaviors="Move" />
</Windows>
</telerik:RadWindowManager>

This used to work in the RadWindow for ASP.NET.

This works now:
<script type="text/javascript">
function openResetPassword()
{
window.radopen("../Forms/PasswordReset.aspx", 'winPasswordReset'); // have no idea why NavigationUrl doesn't work
}
</script> 

But the size and behaviors parameters seem to be ignored.
Georgi Tunev
Telerik team
 answered on 23 Jun 2008
1 answer
163 views
Hi,
In my page i have 2 user controls ,in the left  rad tree and in the right RadDock .
I want to use the tree as a menu for the rad Dock so every node click change the RadDock  user control  and i want to use the ability to edit node.
my problem is that : if add
menuTree.NodeClick += new RadTreeViewEventHandler(menuTree_NodeClick); 
the clicked node dont save his highlight situation for the edit

the menu user control :
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Menu.ascx.cs" Inherits="GRT.DashBoard.Web.UserControls.MainMenu.Menu" %> 
<%@ Register Assembly="GRT.DashBoard.Web" Namespace="GRT.DashBoard.Web.Controls" 
    TagPrefix="cc1" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<%@ Register Src="MenuToolBar.ascx" TagName="MenuToolBar" TagPrefix="uc1" %> 
 
<script type="text/javascript" src="../../JavaScript/Utils.js" ></script>  
<script type="text/javascript">  
function GetMenuRadTreeView()  
{  
   var menuRadTreeViewClientID = '<%=GRTRadPanelBar.FindItemByValue("Dashboard").FindControl("menuRadTreeView").ClientID %>';  
   var menuRadTreeViewClientObj = $find(menuRadTreeViewClientID);  
   return menuRadTreeViewClientObj;  
}  
 
function EditDashboardNode()  
{  
   var tree = GetMenuRadTreeView();  
   var node = tree.get_selectedNode();  
   if(node)  
   {  
       node.startEdit();           
   }  
}  
 
 
 
</script> 
 
<div runat="server" id="dvMenu">  
     
    <telerik:RadPanelBar ID="GRTRadPanelBar" runat="server" Skin="Hay">  
        <CollapseAnimation Type="None" Duration="100"></CollapseAnimation> 
        <Items> 
            <telerik:RadPanelItem runat="server" Value="Dashboard" Text="Dashboard">  
                <ItemTemplate> 
                    <cc1:Toolbar ID="MenueRadToolBar" runat="server" BackgroundImage="~/Images/Menu_tab.jpg">  
                        <cc1:ToolbarButton ID="btnAdd" ImageUrl="Images/Menu_toolbar_AddIcon.jpg" runat="server" 
                            OnClick="btnAdd_Click"></cc1:ToolbarButton> 
                        <cc1:ToolbarButton runat="server" ImageUrl="Images/Menu_toolbar_RemaneIcon.jpg" ID="btnRename" 
                             OnClientClick="EditDashboardNode();return false;"></cc1:ToolbarButton> 
                        <cc1:ToolbarButton runat="server" ImageUrl="Images/Menu_toolbar_DeleteIcon.jpg" ID="btnRemove" 
                            OnClick="btnRemove_Click"></cc1:ToolbarButton> 
                    </cc1:Toolbar> 
                      
                    <telerik:RadAjaxPanel ID="menuRadAjaxPanel" runat="server" HorizontalAlign="NotSet" LoadingPanelID="RadAjaxLoadingPanel">  
                        <telerik:RadTreeView ID="menuRadTreeView" runat="server" AllowNodeEditing="True" 
                            ShowLineImages="False" > 
                        </telerik:RadTreeView> 
                    </telerik:RadAjaxPanel> 
                      
                </ItemTemplate> 
            </telerik:RadPanelItem> 
            <telerik:RadPanelItem runat="server" Text="Reports">  
            </telerik:RadPanelItem> 
            <telerik:RadPanelItem runat="server" Text="Safety Drilldown">  
              
            </telerik:RadPanelItem> 
            <telerik:RadPanelItem runat="server" Text="Admin">  
            </telerik:RadPanelItem> 
        </Items> 
        <ExpandAnimation Type="None" Duration="100"></ExpandAnimation> 
    </telerik:RadPanelBar> 
 
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel" runat="server" > 
        <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' 
            style="border: 0px;" /> 
    </telerik:RadAjaxLoadingPanel> 
    <br /> 
</div> 
 
Thanks  for any help
Roiy
Atanas Korchev
Telerik team
 answered on 23 Jun 2008
1 answer
125 views
Good Morning,

I'm having an issue where I'm trying to use a javascript code block to pull data from a popup window and displaying it in a text box located in a grid. The issue is that when I add the <%= %> processing block to the javascript I get the usual error if not using the RadCodeBlock. I've read the posts that say to add this around my script blocks but I can't find the Telerik.Web.UI assembly in the installed ASP.NET AJAX Q1 2008 install. Am I missing something here? Has it been moved to another assembly?

Mike Langley
Daniel
Telerik team
 answered on 23 Jun 2008
2 answers
114 views
I am experiencing difficulty doing any edits/inserts/deletes on child tables within the grid obj.
using the sample provided that displays hierarchal tables. http://www.telerik.com/demos/aspnet/prometheus/Grid/Examples/Hierarchy/ThreeLevel/DefaultCS.aspx
i removed the third child as it was redundant to the issue - you will not the allowAutomaticUpdates is enabled, along with the gridEditCommanColumn.  thoughts on why this would not work?
 <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
        <telerik:RadGrid ID="RadGrid1" Skin="Office2007" ShowGroupPanel="True" ShowStatusBar="True" 
            runat="server" DataSourceID="SqlDataSource1" Width="95%" AutoGenerateColumns="False" 
            PageSize="3" AllowSorting="True" AllowPaging="True" GridLines="None">  
            <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle> 
            <MasterTableView Width="100%" DataSourceID="SqlDataSource1"   
            DataKeyNames="CustomerID" AllowMultiColumnSorting="True">  
                <DetailTables> 
                    <telerik:GridTableView AllowAutomaticUpdates="true" DataSourceID="SqlDataSource2"   
                    Width="100%" runat="server">  
                        <ParentTableRelation> 
                            <telerik:GridRelationFields DetailKeyField="CustomerID"   
                            MasterKeyField="CustomerID" /> 
                        </ParentTableRelation> 
                        <Columns> 
                        <telerik:GridEditCommandColumn ButtonType="PushButton">  
                        </telerik:GridEditCommandColumn> 
                            <telerik:GridBoundColumn SortExpression="OrderID" HeaderText="OrderID" DataField="OrderID" UniqueName="OrderID">  
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn SortExpression="OrderDate" HeaderText="Date Ordered" DataField="OrderDate" UniqueName="OrderDate">  
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn SortExpression="EmployeeID" HeaderText="EmployeeID" DataField="EmployeeID" UniqueName="EmployeeID">  
                            </telerik:GridBoundColumn> 
                        </Columns> 
                    </telerik:GridTableView> 
                </DetailTables> 
                <Columns> 
                    <telerik:GridBoundColumn SortExpression="CustomerID" HeaderText="CustomerID" DataField="CustomerID" UniqueName="CustomerID">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn SortExpression="ContactName" HeaderText="Contact Name" DataField="ContactName" UniqueName="ContactName">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn SortExpression="CompanyName" HeaderText="Company" DataField="CompanyName" UniqueName="CompanyName">  
                    </telerik:GridBoundColumn> 
                </Columns> 
            </MasterTableView> 
            <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True">  
                <Resizing AllowRowResize="True" AllowColumnResize="True"></Resizing> 
            </ClientSettings> 
        </telerik:RadGrid>&nbsp;<br /> 
        <br /> 
          
<asp:SqlDataSource ID="SqlDataSource1"   
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" 
            ProviderName="System.Data.SqlClient" 
            SelectCommand="SELECT * FROM Customers" runat="server"></asp:SqlDataSource> 
<asp:SqlDataSource ID="SqlDataSource2"   
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"   
            SelectCommand="SELECT * FROM [Orders] WHERE ([CustomerID] = @CustomerID)" runat="server"   
            DeleteCommand="DELETE FROM [Orders] WHERE [OrderID] = @OrderID"   
            UpdateCommand="UPDATE [Orders] SET  [EmployeeID] = @EmployeeID, [OrderDate] = @OrderDate   
            WHERE [OrderID] = @OrderID"> 
            <SelectParameters> 
                <asp:SessionParameter Name="CustomerID" SessionField="CustomerID" Type="String" /> 
            </SelectParameters> 
    <DeleteParameters> 
        <asp:Parameter Name="OrderID" Type="Int32" /> 
    </DeleteParameters> 
    <UpdateParameters> 
        <asp:Parameter Name="EmployeeID" Type="Int32" /> 
        <asp:Parameter Name="OrderDate" Type="DateTime" /> 
        <asp:Parameter Name="OrderID" Type="Int32" /> 
    </UpdateParameters> 
     
        </asp:SqlDataSource> 
        </asp:Content> 

Shinu
Top achievements
Rank 2
 answered on 23 Jun 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?