Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
70 views
We have a project where we have been successfully using the radmenu with statically defined menuitems but due to page weight and exceptionally long js render times we are trying to use the webservice population mode.  We have the code running within our control in a test harness successfully but when we run within our sharepoint environment the server side onclick events are not being triggered.  These same onclick events are being caught in the debugger when running our code outside of sharepoint.  Using fiddler we see a postback does occur when the menu item is clicked. 

Do you have any suggestions on what to check/where to look next.

Thanks.

 

 

<telerik:RadMenu ID="xxxRadMenu" runat="server" Skin="Office2007" ClickToOpen="true"

 

 

 

OnClientItemClicking="DoIt.OnMenuItemClicking" OnItemClick="xxxRadMenu_ItemClicked"

 

 

 

CollapseAnimation-Type="None" CssClass="ActionsRadMenu" OnClientItemPopulating="itemPopulating">

 

 

 

<WebServiceSettings Method="PopulateAccountMenuItems" />

 

 

 

<Items>

 

 

 

<telerik:RadMenuItem Text="Actions..."

 

 

 

Value="Actions"

 

 

 

PostBack="false"

 

 

 

ExpandMode="WebService">

 

 

 

</telerik:RadMenuItem>

 

 

 

</Items>

 

 

 

</telerik:RadMenu>

 

Kalina
Telerik team
 answered on 16 Oct 2011
11 answers
267 views
We wanted to use something better than "title" property on our control to see a beautiful tooltip everywhere.

I saw that on the telerik documentation: (source Telerik documentation for autotooltipify property)
Gets or sets a value whether the RadToolTipManager, when its TargetControls collection is empty will tooltipify automatically all elements on the page that have a 'title' attribute   

Wonderful ! I only have to put a radtooltipmanager on my masterpage and every title will be converted to beautiful tooltip !

BUT ???

Ok, title are converted to tooltip.  But not only title, ALT also.  I have a lot <img src="..." alt="..."> tags on my pages and I do not want alt to be converted to tooltip !  How can I have only my TITLE property converted to tooltip, not my ALT property ?
Grant Henderson
Top achievements
Rank 1
 answered on 16 Oct 2011
2 answers
71 views
Hi,

I have a Sharepoint webpart wherein I use the RadPanelBar, However when I click on the arrows of the item header it doesnt expand or collapse but when I clicked on the other parts of the header it does expand /Collapse. Do I miss something in my code?

Thanks!

Regards,

Kunal
Kalina
Telerik team
 answered on 16 Oct 2011
5 answers
164 views
Hello,

I have a bit of an issue:

I have four ComboBoxes on the page as seen below:

<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="ddlCountry">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="ddlState" UpdatePanelHeight="" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="ddlState">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="ddlLocation" UpdatePanelHeight="" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="ddlLocation">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="ddlPostcode" UpdatePanelHeight="" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>
 
 
                    <table id="Table1" width="100%" class="style1">
                        <tr runat="server" width="150px" id="tr10">
                            <td>
                                Country 
                            </td>
                            <td>
                                <telerik:RadComboBox ID="ddlCountry" runat="server" OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged"
                                    Width="300px" EnableLoadOnDemand="True" AutoPostBack="True">
                                </telerik:RadComboBox>
                                <asp:RequiredFieldValidator ID="rfvCountry" runat="server" ErrorMessage="*" ControlToValidate="ddlCountry"
                                    ValidationGroup="Customer"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr runat="server" id="trState">
                            <td>
                                State 
                            </td>
                            <td>
                                <telerik:RadComboBox ID="ddlState" OnSelectedIndexChanged="ddlState_SelectedIndexChanged"
                                    Width="300px" runat="server" AutoPostBack="True">
                                </telerik:RadComboBox>
                                <asp:RequiredFieldValidator ID="rfvState" runat="server" ErrorMessage="*" ControlToValidate="ddlState"
                                    ValidationGroup="Customer"></asp:RequiredFieldValidator>
                            </td>
                            <td>
                                Location 
                            </td>
                            <td>
                                <telerik:RadComboBox ID="ddlLocation" OnSelectedIndexChanged="ddlLocation_SelectedIndexChanged"
                                    Width="300px" runat="server" AutoPostBack="True">
                                </telerik:RadComboBox>
                                <asp:RequiredFieldValidator ID="rfvLocation" runat="server" ErrorMessage="*" ControlToValidate="ddlLocation"
                                    ValidationGroup="Customer"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr runat="server" id="trPostcode">
                            <td>
                                Postcode 
                            </td>
                            <td>
                                <telerik:RadComboBox ID="ddlPostcode" runat="server" Width="300px">
                                </telerik:RadComboBox>
                                <asp:RequiredFieldValidator ID="rfvPostcode" runat="server" ErrorMessage="*" ControlToValidate="ddlPostcode"
                                    ValidationGroup="Customer"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                    </table>

all data-bound from c# like so (including selected index changed);

#region Location ddls
private void BindCountry()
{
    string sql = "SELECT DISTINCT LookupID_LookupTable, LookupID, LookupParentID FROM " + XDEV.xd_Schema.ToString() + "xd_lookup_tables WHERE (LookupParentID = 41)";
    DataTable dt = data.GetDataTable(sql);
    if (dt.Rows.Count > 0)
    {
        ddlCountry.DataSource = dt;
        ddlCountry.DataTextField = "LookupID_LookupTable";
        ddlCountry.DataValueField = "LookupID";
        ddlCountry.DataBind();
        //RadAjaxManager1.FocusControl(ddlCountry);
    }
}
private void BindState(string country)
{
    string sql = string.Format("SELECT DISTINCT LookupID_LookupTable, LookupID, LookupParentID FROM " + XDEV.xd_Schema.ToString() + "xd_lookup_tables WHERE ( LookupID_ParentLookupID ={0})", country);
    DataTable dt = data.GetDataTable(sql);
    if (dt.Rows.Count > 0)
    {
        ddlState.DataSource = dt;
        ddlState.DataTextField = "LookupID_LookupTable";
        ddlState.DataValueField = "LookupID";
        ddlState.DataBind();
        //RadComboBoxItem StateItem = new RadComboBoxItem("- Select a State -", "0"); //Creates new item for RadCombobox 
        //ddlState.Items.Add(StateItem);
    }
}
private void BindLocation(string state)
{
    string sql = string.Format("SELECT DISTINCT LookupID_LookupTable, LookupID, LookupParentID FROM " + XDEV.xd_Schema.ToString() + "xd_lookup_tables WHERE ( LookupID_ParentLookupID = {0})", state);
    DataTable dt = data.GetDataTable(sql);
    if (dt.Rows.Count > 0)
    {
        ddlLocation.DataSource = dt;
        ddlLocation.DataTextField = "LookupID_LookupTable";
        ddlLocation.DataValueField = "LookupID";
        ddlLocation.DataBind();
        //RadComboBoxItem LocationItem = new RadComboBoxItem("- Select a Location -", "0"); //Creates new item for RadCombobox 
        //ddlLocation.Items.Add(LocationItem);
    }
}
private void BindPostcode(string location)
{
    string sql = string.Format("SELECT DISTINCT LookupID_LookupTable, LookupID, LookupParentID FROM " + XDEV.xd_Schema.ToString() + "xd_lookup_tables WHERE ( LookupID_ParentLookupID = {0})", location);
    DataTable dt = data.GetDataTable(sql);
    if (dt.Rows.Count > 0)
    {
        ddlPostcode.DataSource = dt;
        ddlPostcode.DataTextField = "LookupID_LookupTable";
        ddlPostcode.DataValueField = "LookupID";
        ddlPostcode.DataBind();
        //RadComboBoxItem PostcodeItem = new RadComboBoxItem("- Select a Postcode -", "0"); //Creates new item for RadCombobox 
        //ddlPostcode.Items.Add(PostcodeItem);
    }
}
 
protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
{
    BindState(ddlCountry.SelectedValue);
}
 
protected void ddlState_SelectedIndexChanged(object sender, EventArgs e)
{
    BindLocation(ddlState.SelectedValue);
}
protected void ddlLocation_SelectedIndexChanged(object sender, EventArgs e)
{
    BindPostcode(ddlLocation.SelectedValue);
}
#endregion

and the existing records are bound like so:

#region cascading ddls
if (!String.IsNullOrEmpty(dt.Rows[0]["LookupID_Country"].ToString()))
{
    if (ddlCountry.Items.Contains(ddlCountry.Items.FindItemByValue(dt.Rows[0]["LookupID_Country"].ToString())))
    {
        ddlCountry.SelectedValue = dt.Rows[0]["LookupID_Country"].ToString();
        BindCountry();
    }
}
if (!String.IsNullOrEmpty(dt.Rows[0]["LookupID_State"].ToString()))
{
    if (ddlState.Items.Contains(ddlState.Items.FindItemByValue(dt.Rows[0]["LookupID_State"].ToString())))
    {
        ddlState.SelectedValue = dt.Rows[0]["LookupID_State"].ToString();
        BindState(ddlCountry.SelectedValue);
    }
    else
    {
         
    }
}
if (!String.IsNullOrEmpty(dt.Rows[0]["LookupID_Location"].ToString()))
{
    if (ddlLocation.Items.Contains(ddlLocation.Items.FindItemByValue(dt.Rows[0]["LookupID_Location"].ToString())))
    {
        ddlLocation.SelectedValue = dt.Rows[0]["LookupID_Location"].ToString();
        BindLocation(ddlState.SelectedValue);
    }
}
if (!string.IsNullOrEmpty(dt.Rows[0]["LookupID_Postcode"].ToString()))
{
    if (ddlPostcode.Items.Contains(ddlPostcode.Items.FindItemByValue(dt.Rows[0]["LookupID_Postcode"].ToString())))
    {
        ddlPostcode.SelectedValue = dt.Rows[0]["LookupID_Postcode"].ToString();
        BindPostcode(ddlLocation.SelectedValue);
    }
}
#endregion);
what is currently occurring is the first ComboBox is being bound with the record but the other 3  are blank where they should display the records from the db.

What needs to happen is when the user clicks 'Edit' button the user control becomes visible with ComboBoxes displaying the existing(non-edited data) and allow the user to change the ComboBox selected value.
Trent
Top achievements
Rank 2
 answered on 16 Oct 2011
2 answers
82 views
Hello Telerik,

I have an embedded imagebutton in a RadGrid with grouping, the grid has an Item command as follows:

# region Radgrid code
 
   protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
   {
       if (e.CommandName == "Select")
       {
           //Session.Add("CustomerID", e.Item.Cells[3].Text.ToString());
           Geek.XTV7_Videos_ID = e.Item.Cells[4].Text.ToString();
       }
   }
 
   #endregion

the image button code is as follows 
xt_Imagebutton.ascx
<asp:ImageButton ID="btnImageDisplay" runat="server" CommandName="Select" OnClick="Image_Click" Width="120px" />
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" />
xt_Imagebutton.ascx.cs
public string source
{
    get
    {
        return btnImageDisplay.ImageUrl;
    }
    set
    {
        btnImageDisplay.ImageUrl = value;
    }
}
protected void Image_Click(object sender, ImageClickEventArgs e)
{
      
    ReturnImages(Geek.XTV7_Videos_ID.ToString());
}
#region SQLCommands
public void ReturnImages(string VideoID)
{
    if (!String.IsNullOrEmpty(Geek.XTV7_Videos_ID.ToString()))
    {
        string sql = "";
        var dt = new DataTable();
        sql += string.Format("Select [XTV7_Videos_Image] From Xtrain.XTV7_2_Videos WHERE  (XTV7_Videos_ID= {0})", VideoID);
        dt = data.GetDataTable(sql);
        if (dt.Rows.Count > 0)
        {
            Geek.XTV7_Image = (dt.Rows[0]["XTV7_Videos_Image"].ToString()).ToString();
            RadAjaxManager1.ResponseScripts.Add("radopen('Forms/View/ImageViewer.aspx','RadWindow2')");
 
        }
        dt.Dispose();
    }
}
#endregion
VideoSelector.ascx
<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" AutoGenerateColumns="False"
    BackColor="White" CellSpacing="0" DataSourceID="SqlDataSource2" EnableLinqExpressions="False"
    GridLines="None" Height="650px" AllowPaging="True" PageSize="4" OnItemCommand="RadGrid1_ItemCommand"
    ShowGroupPanel="True">
    <ClientSettings EnablePostBackOnRowClick="true">
        <Selecting AllowRowSelect="True" />
        <ClientEvents OnRowSelected="RowSelected" />
        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
    </ClientSettings>
    <MasterTableView AllowMultiColumnSorting="true" DataKeyNames="XTV7_Videos_ID,XTV7_Videos_Image"
        DataSourceID="SqlDataSource2" ShowGroupFooter="false" Summary="Video Lessons">
        <CommandItemSettings ExportToPdfText="Export to PDF" />
        <GroupByExpressions>
            <telerik:GridGroupByExpression>
                <SelectFields>
                    <telerik:GridGroupByField FieldAlias=":" FieldName="XTV7_Categories_Name" />
                    <telerik:GridGroupByField FieldAlias="SubCategory" FieldName="XTV7_Categories_Sub_Name" />
                </SelectFields>
                <GroupByFields>
                    <telerik:GridGroupByField FieldName="XTV7_Videos_Date_Uploaded" HeaderText="Sort By Date Uploaded"
                        SortOrder="Descending" />
                </GroupByFields>
            </telerik:GridGroupByExpression>
        </GroupByExpressions>
        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
        </RowIndicatorColumn>
        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
        </ExpandCollapseColumn>
        <Columns>
            <telerik:GridTemplateColumn AllowFiltering="false" HeaderStyle-Width="110px" HeaderText="Lesson Snapshot"
                ItemStyle-Width="110px" SortExpression="XTV7_Categories_Image" UniqueName="XTV7_Categories_Sub_Image">
                <ItemTemplate>
                    <%--                            <asp:ImageButton ID="btnImageDisplay" runat="server" CommandName="Select" ImageUrl='<%# "~/App_Portal/xTrain/Images/VideoImages/" + Eval("XTV7_Videos_Image") %>' OnClick="Image_Click" Width="120px" />--%>
                    <xTrain:xImgButton ID="xt_ImageButton1" runat="server" source='<%# "~/App_Portal/xTrain/Images/VideoImages/" + Eval("XTV7_Videos_Image") %>' />
                </ItemTemplate>
                <HeaderStyle Width="130px" />
                <ItemStyle Width="110px" />
            </telerik:GridTemplateColumn>
            <telerik:GridBoundColumn DataField="XTV7_Videos_ID" DataType="System.Int32" FilterControlAltText="Filter XTV7_Videos_ID column"
                HeaderText="ID" ItemStyle-Width="20px" ReadOnly="False" SortExpression="XTV7_Videos_ID"
                UniqueName="XTV7_Videos_ID" Visible="False">
                <ItemStyle Width="20px" />
            </telerik:GridBoundColumn>
            <telerik:GridTemplateColumn AllowFiltering="false" HeaderStyle-Width="50px" ItemStyle-Width="50px">
                <ItemTemplate>
                    <asp:ImageButton ID="imgbtnStartVideo" runat="server" CommandName="Select" ImageUrl="~/App_Themes/XGIS/Images/LessonLevels/PlayVideo32.png"
                        ToolTip="Play Video" />
                </ItemTemplate>
                <HeaderStyle Width="50px" />
                <ItemStyle Width="50px" />
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn AllowFiltering="false" HeaderStyle-Width="50px" ItemStyle-Width="50px">
                <ItemTemplate>
                    <asp:ImageButton ID="imgbtnStartVideoIPOD" runat="server" CommandName="Select" ImageUrl="~/App_Themes/XGIS/Images/LessonLevels/IPAD30.png"
                        ToolTip="Podcast" />
                </ItemTemplate>
                <HeaderStyle Width="50px" />
                <ItemStyle Width="50px" />
            </telerik:GridTemplateColumn>
            <telerik:GridBoundColumn Aggregate="Count" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"
                DataField="XTV7_Videos_Title" EmptyDataText="Search Titles" FilterControlToolTip="Search Titles"
                FilterControlWidth="200px" FooterText="Videos: " HeaderStyle-Width="240px" HeaderText="Search Video Titles"
                ItemStyle-Width="50px" ItemStyle-Wrap="true" SortExpression="XTV7_Videos_Title"
                UniqueName="XTV7_Videos_Title">
                <HeaderStyle Width="240px" />
                <ItemStyle Width="50px" Wrap="True" />
            </telerik:GridBoundColumn>
            <telerik:GridTemplateColumn AllowFiltering="false" DataField="XTV7_Videos_Difficulty"
                DataType="System.Int32" HeaderText="Difficulty" ItemStyle-Width="20px" SortExpression="XTV7_Videos_Difficulty"
                UniqueName="XTV7_Videos_Difficulty">
                <ItemTemplate>
                    <asp:Image ID="imgD" runat="server" ImageUrl='<%# GetImageUrl((int)Eval("XTV7_Videos_Difficulty")) %>' />
                </ItemTemplate>
                <ItemStyle Width="20px" />
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn AllowFiltering="false" DataField="XTV7_Videos_Captions"
                DataType="System.Byte" HeaderText="Captions" ItemStyle-Width="20px" SortExpression="XTV7_Videos_Captions"
                UniqueName="XTV7_Videos_Captions">
                <ItemTemplate>
                    <asp:Image ID="imgCaption" runat="server" ImageUrl='<%# (bool)Eval("XTV7_Videos_Captions") ? "~/App_Themes/XGIS/images/boolean/true.gif" : "~/App_Themes/XGIS/images/boolean/false.gif" %>' />
                </ItemTemplate>
                <ItemStyle Width="20px" />
            </telerik:GridTemplateColumn>
            <telerik:GridBoundColumn AllowFiltering="False" DataField="XTV7_VideoHits" DataType="System.Int32"
                FilterControlAltText="Filter XTV7_VideoHits column" HeaderText="Hits" SortExpression="XTV7_VideoHits"
                UniqueName="XTV7_VideoHits">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="XTV7_Videos_FileName" DataType="System.String"
                HeaderText="Hits" SortExpression="XTV7_Videos_FileName" UniqueName="XTV7_Videos_FileName"
                Visible="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="XTV7_Videos_Date_Uploaded" DataFormatString="{0:d}"
                DataType="System.DateTime" HeaderText="Uploaded" SortExpression="XTV7_Videos_Date_Uploaded"
                UniqueName="XTV7_Videos_Date_Uploaded" Visible="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="XTV7_Categories_Name" HeaderText="XTV7_Categories_Name"
                SortExpression="XTV7_Categories_Name" UniqueName="XTV7_Categories_Name" Visible="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="XTV7_Categories_Sub_Name" HeaderText="XTV7_Categories_Sub_Name"
                SortExpression="XTV7_Categories_Sub_Name" UniqueName="XTV7_Categories_Sub_Name"
                Visible="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="XTV7_Categories_ID" DataType="System.Int32" HeaderText="XTV7_Categories_ID"
                SortExpression="XTV7_Categories_ID" UniqueName="XTV7_Categories_ID" Visible="false"
                ReadOnly="false">
            </telerik:GridBoundColumn>
        </Columns>
        <EditFormSettings>
            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
            </EditColumn>
        </EditFormSettings>
    </MasterTableView>
    <PagerStyle EnableSEOPaging="True" PageButtonCount="20" />
    <FilterMenu EnableImageSprites="False">
    </FilterMenu>
    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Black">
    </HeaderContextMenu>
</telerik:RadGrid>

What I am attempting to acheive is when the button's OnClick event is fired I want RadGrid1_ItemCommand to extract the MasterKeyValue of the Select command and pass the ID to the session variable XTV7_Videos_ID that is managed by the Session Handler GEEK (Geek.XTV7_Videos_ID)

The issue exists when the OnClick event is fired, for some reason the RadGrid1_ItemCommand does not get fired until after the OnClick event method is complete. so there for the CommandName="Select" is not occuring until after the fact.

How can I resolve this problem and get the ItemCommand firering as soon as the CommandName is hit or can I call/trigger the ItemCommand from the OnClick event?

Ever so grateful, 
Trent



Trent
Top achievements
Rank 2
 answered on 16 Oct 2011
1 answer
96 views
Hello,
I have a radgrid that contains a detailstable. When I have to delete a parent record, no problem to get datakeyvalues. When I try to delete a child record, I am able to get DataKeyNames but DataKeyValues is empty!

The definition of DetailsTable is this:
         <DetailTables>
            <telerik:GridTableView name="Partecipanti" TableLayout="Fixed" DataKeyNames="PortalID,UserID,CodRiunione" AllowFilteringByColumn="false"
                DataSourceID="objDataSourceGridPartecipantiRiunione" Width="60%" HorizontalAlign="Right"
                ShowFooter="false" ShowGroupFooter="false" AllowCustomSorting="false" AllowCustomPaging="false"
                CommandItemSettings-AddNewRecordText="Conferma / Rifiuta partecipazione" CommandItemDisplay="Top"
                CommandItemSettings-ShowRefreshButton="false"
                runat="server">
                <ParentTableRelation>
                    <telerik:GridRelationFields DetailKeyField="PortalID,CodRiunione" MasterKeyField="PortalID,ItemID" />
                </ParentTableRelation>
                <Columns>
                    <telerik:GridBoundColumn Visible="false" HeaderText="PortalID" AllowFiltering="false"
                        DataField="PortalID" UniqueName="PortalID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn Visible="false" HeaderText="UserID" AllowFiltering="false"
                        DataField="UserID" UniqueName="UserID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn Visible="false" HeaderText="CodRiunione" AllowFiltering="false"
                        DataField="CodRiunione" UniqueName="CodRiunione">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderStyle-Width="200" HeaderText="Partecipanti" AllowFiltering="false"
                        DataField="Nominativo" UniqueName="Nominativo">
                    </telerik:GridBoundColumn>
                    <telerik:GridCheckBoxColumn Visible="false" HeaderText="FlgConfermaPartecipazione"
                        AllowFiltering="false" DataField="FlgConfermaPartecipazione" UniqueName="FlgConfermaPartecipazione">
                    </telerik:GridCheckBoxColumn>
                    <telerik:GridBoundColumn HeaderStyle-Width="120" HeaderText="Stato" AllowFiltering="false"
                        DataField="ConfermaPartecipazioneTestuale" UniqueName="ConfermaPartecipazioneTestuale">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="Note" AllowFiltering="false" DataField="Note" MaxLength="150"
                        UniqueName="Note">
                    </telerik:GridBoundColumn>
                    <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Edit" Text="Modifica"
                        UniqueName="EditDetailCommandColumn" HeaderStyle-Width="30">
                        <HeaderStyle Width="30px"></HeaderStyle>
                        <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                    </telerik:GridButtonColumn>
                    <telerik:GridButtonColumn ConfirmText="Sei sicuro di voler eliminare il partecipante da questa riunione?"
                        ConfirmDialogType="Classic" ConfirmTitle="Conferma cancellazione" ButtonType="ImageButton"
                        CommandName="Delete" Text="Elimina" UniqueName="DeleteDetailColumn" HeaderStyle-Width="30">
                        <HeaderStyle Width="30px"></HeaderStyle>
                        <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                    </telerik:GridButtonColumn>
                </Columns>
                <EditFormSettings EditFormType="Template">
                    <FormTemplate>
                        <table border="0" cellspacing="2" cellpadding="1" width="100%" border="1" rules="none"
                            style="border-collapse: collapse">
                            <tr class="EditFormHeader">
                                <td colspan="2">
                                    <b>Conferma / Rifiuta partecipazione</b>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <table border="0" cellspacing="1" cellpadding="1" width="100%" border="0">
                                        <tr>
                                            <td>
                                                Utente:
                                            </td>
                                            <td>
                                                <telerik:RadComboBox ID="RadComboBoxUtente" runat="server" DataSourceID="objDataSourceUtentiUfficialiNonUfficialiGDL"
                                                    Filter="Contains" DataTextField="NominativoConFlagPredefinito" Width="400" DataValueField="UserID"
                                                    SelectedValue='<%# Bind("UserID") %>'>
                                                </telerik:RadComboBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                Presenza:
                                            </td>
                                            <td>
                                                <telerik:RadComboBox ID="RadComboBoxPartecipazione" Width="150" runat="server" SelectedValue = '<%# Bind("FlgConfermaPartecipazione") %>' OnDataBinding="RadComboBoxPartecipazione_OnDataBinding">
                                                    <Items>
                                                        <telerik:RadComboBoxItem Text="Parteciperò" Value="1"   />
                                                        <telerik:RadComboBoxItem Text="Non parteciperò" Value="0"  />
                                                    </Items>
                                                </telerik:RadComboBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                Note:
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtNote" MaxLength="150" Width="300" runat="server" Text='<%# Bind("Note") %>'>
                                                </asp:TextBox>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td align="right" colspan="2">
                                    <br /><br />
                                    <telerik:RadButton ID="btnUpdate" runat="server" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Inserisci", "Aggiorna") %>'
                                        CssClass="MyImageButton" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'>
                                    </telerik:RadButton>
                                    <telerik:RadButton ID="btnCancel" Text="Annulla" runat="server" CausesValidation="False"
                                        CommandName="Cancel">
                                    </telerik:RadButton>
                                </td>
                            </tr>
                        </table>
                        <asp:HiddenField ID="hidUserID" runat="server" Value='<%# UserID %>' />
                    </FormTemplate>
                    <EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column">
                    </EditColumn>
                </EditFormSettings>
                <NoRecordsTemplate>
                    Nessun partecipante per questa riunione
                </NoRecordsTemplate>
            </telerik:GridTableView>
        </DetailTables>

and this is the line I use to retrieve datakeyvalues:
DirectCast(DirectCast(rdgrd_Agenda, Telerik.Web.UI.RadGrid).MasterTableView.DetailTables(0),Telerik.Web.UI.GridTableView).DataKeyValues(e.Item.ItemIndex)("UserID")

The array as Count=0. Where I am wrong?
Thanks
Mario
Top achievements
Rank 1
 answered on 15 Oct 2011
3 answers
128 views
I am building up the grid dynamically based on metadata. When I started building the grid, the sorting and grouping worked. Then after some time I found out that it is not working anymore. When I click on the column header, the SortCommand event is not raised. I checked that the AllowSorting property is set to true.

I tried to find out what caused the sorting to stop working, but cannot find it. What could cause this?

PS I use the __EVENTARGS in a postback to indicate what action the user wants to be performed. Do you use that too?
Ewald
Top achievements
Rank 1
 answered on 15 Oct 2011
2 answers
348 views
Hello,

I have created a composite control with the RadDatePicker and 2 CompareValidators and 1 CustomValidator.  When I try to attach the RadDatePicker to a RequiredFieldValidator from the calling page i am getting the Error

Unable to find control id 'calendarControl_CtcRadDatePicker' referenced by the 'ControlToValidate' property of 'reqValidator'.


Control
/// <summary>
    /// Summary description for CalendarControl
    /// </summary>
    [ToolboxData("<{0}:CalendarControl runat=server></{0}:CalendarControl>")]
    [ValidationProperty("SelectedDate")]
    public class CalendarControl : CompositeControl
    {
        private const string DEFAULT_SKIN = "CentreTelerik";

        private RadDatePicker _radDatePicker;
        private CompareValidator _cpvMaxDateOccurred;
        private CompareValidator _cpvMinDateOccurred;
        private CustomValidator _custValidator;

        public CalendarControl()
        {

        }

        #region Instance properties

        public DateTime MinDate
        {
            get { return (DateTime)(ViewState["CtcMinDate"] ?? _radDatePicker.MinDate); }
            set
            {
                ViewState["CtcMinDate"] = value;
                EnsureChildControls();
                _radDatePicker.MinDate = value;
            }
        }

        public DateTime MaxDate
        {
            get { return (DateTime)(ViewState["CtcMaxDate"] ?? _radDatePicker.MaxDate); }
            set
            {
                ViewState["CtcMaxDate"] = value;
                EnsureChildControls();
                _radDatePicker.MaxDate = value;
            }
        }

        public DateTime SelectedDate
        {
            get { EnsureChildControls(); return _radDatePicker.SelectedDate.GetValueOrDefault(); }
            set { EnsureChildControls(); _radDatePicker.SelectedDate = value; }
        }

        public string ClientIDWrapper
        {
            get { EnsureChildControls(); return _radDatePicker.ClientID; }
        }

        #endregion

        #region Override Instance methods

        protected override ControlCollection CreateControlCollection()
        {
            EnsureChildControls();
            return base.CreateControlCollection();
        }

        protected override void CreateChildControls()
        {
            Controls.Clear();

            base.CreateChildControls();

            _radDatePicker = new RadDatePicker();
            _radDatePicker.ID = "CtcRadDatePicker";
            _radDatePicker.EnableEmbeddedSkins = false;
            _radDatePicker.Calendar.EnableEmbeddedSkins = false;
            _radDatePicker.Calendar.ShowRowHeaders = false;
            _radDatePicker.DateInput.EnableEmbeddedSkins = false;

            _cpvMaxDateOccurred = new CompareValidator();
            _cpvMaxDateOccurred.ID = "CtcMaxValidator";
            _cpvMaxDateOccurred.Type = ValidationDataType.Date;
            _cpvMaxDateOccurred.Operator = ValidationCompareOperator.LessThanEqual;
            _cpvMaxDateOccurred.Display = ValidatorDisplay.Dynamic;
            _cpvMaxDateOccurred.ControlToValidate = _radDatePicker.ClientID;
            _cpvMaxDateOccurred.ValueToCompare = _radDatePicker.MaxDate.ToShortDateString();
            _cpvMaxDateOccurred.SetFocusOnError = true;

            _cpvMinDateOccurred = new CompareValidator();
            _cpvMinDateOccurred.ID = "CtcMinValidator";
            _cpvMinDateOccurred.Type = ValidationDataType.Date;
            _cpvMinDateOccurred.Operator = ValidationCompareOperator.GreaterThanEqual;
            _cpvMinDateOccurred.Display = ValidatorDisplay.Dynamic;
            _cpvMinDateOccurred.ControlToValidate = _radDatePicker.ClientID;
            _cpvMinDateOccurred.ValueToCompare = _radDatePicker.MinDate.ToShortDateString();
            _cpvMinDateOccurred.SetFocusOnError = true;

            _custValidator = new CustomValidator();
            _custValidator.ID = "CtcCustomValidatorInvalidDate";
            _custValidator.ControlToValidate = _radDatePicker.ClientID;
            _custValidator.Display = ValidatorDisplay.Dynamic;
            _custValidator.ErrorMessage = "Invalid Date";

            Controls.Add(_radDatePicker);
            Controls.Add(_cpvMaxDateOccurred);
            Controls.Add(_cpvMinDateOccurred);
            Controls.Add(_custValidator);

            FooterTemplate template = new FooterTemplate(_radDatePicker.ClientID, "Today", !IsTodayDisabled());
            _radDatePicker.Calendar.FooterTemplate = template;

            
        }

        protected override void OnDataBinding(EventArgs e)
        {
            EnsureChildControls();
            base.OnDataBinding(e);
        }

        protected override void OnPreRender(EventArgs e)
        {
            _radDatePicker.Skin = DEFAULT_SKIN;
            _radDatePicker.DateInput.Skin = DEFAULT_SKIN;
            _radDatePicker.Calendar.Skin = DEFAULT_SKIN;
            _radDatePicker.Enabled = Enabled;
            _radDatePicker.DateInput.ClientEvents.OnError = "CalendarControlOnError";
            _radDatePicker.DatePopupButton.ToolTip = ToolTip;

            _cpvMaxDateOccurred.Enabled = Enabled;
            _cpvMaxDateOccurred.ValueToCompare = _radDatePicker.MaxDate.ToShortDateString();
            _cpvMaxDateOccurred.ErrorMessage = "Max date error";

            _cpvMinDateOccurred.Enabled = Enabled;
            _cpvMinDateOccurred.ValueToCompare = _radDatePicker.MinDate.ToShortDateString();
            _cpvMinDateOccurred.ErrorMessage = "Min date error";

            _custValidator.ClientValidationFunction = "CalendarControlClientValidationFunction";
            _custValidator.ValidateEmptyText = true;

            base.OnPreRender(e);
        }

        protected override void Render(HtmlTextWriter writer)
        {
            base.Render(writer);
            _radDatePicker.RenderControl(writer);
            _cpvMaxDateOccurred.RenderControl(writer);
            _cpvMinDateOccurred.RenderControl(writer);
            _custValidator.RenderControl(writer);
        }
        #endregion

        #region Private methods
        private bool IsTodayDisabled()
        {
            bool todayDisabled = false;
            foreach (RadCalendarDay disabled in _radDatePicker.Calendar.SpecialDays)
            {
                if (disabled.IsToday)
                {
                    todayDisabled = true;
                    break;
                }
            }
            return todayDisabled;
        }
        #endregion


        sealed class FooterTemplate : ITemplate
        {
            private string _clientId;
            private string _todayText;
            private bool _enabled;

            #region ITemplate Members
            public FooterTemplate(string clientId, string todayText, bool enabled)
            {
                _clientId = clientId;
                _todayText = todayText;
                _enabled = enabled;
            }

            public void InstantiateIn(Control container)
            {
                RadCodeBlock block = new RadCodeBlock();
                block.ID = "footerCodeBlock";

                LiteralControl link = new LiteralControl();
                link.ID = "todayLink";
                link.DataBinding += new EventHandler(link_DataBinding);
                StringBuilder text = new StringBuilder();
                text.Append("<div style=\"text-align:center; width:100%;\">");
                if (_enabled)
                {
                    text.AppendFormat("<a href=\"\" onclick=\"javascript: var picker = $find('{0}');  picker.set_selectedDate(new Date());  picker.hidePopup(); return false;\">{1}</a>", _clientId, _todayText);
                }
                else
                {
                    text.AppendFormat("{0}", _todayText);
                }
                text.Append("</div>");
                link.Text = text.ToString();
                block.Controls.Add(link);

                container.Controls.Add(block);
            }

            void link_DataBinding(object sender, EventArgs e)
            {
                LiteralControl literalControl = (LiteralControl)sender;
                DataListItem list = (DataListItem)literalControl.NamingContainer;
            }
            #endregion
        }
    }
-------------------------------------------------
Calling Page
form id="form1" runat="server">
    <div>
    
        <script type="text/javascript">
        var invalidInput = false;

        function CalendarControlOnError(sender, args) {
            
            sender.updateCssClass();   
            if (args.get_reason() == Telerik.Web.UI.InputErrorReason.OutOfRange) {
                args.set_cancel(true);
                event.cancelBubble = true;
            }
            else {
                //args.set_cancel(true);
                //event.cancelBubble = true;
                invalidInput = true;
            }
        }

        function CalendarControlClientValidationFunction(sender, args) {
            if (invalidInput)
                args.IsValid = false;
            invalidInput = false;
        }
        </script>
        
        <telerik:RadScriptManager ID="radScriptManager" runat="server" />
        <centre:CalendarControl ID="calendarControl" runat="server" />
        
        <asp:RequiredFieldValidator ID="reqValidator" runat="server" ErrorMessage="Required" />
        <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="Save_OnClick" />
    </div>
-----------------------------------------------
code behind
protected override void OnInit(EventArgs e)
        {
            reqValidator.ControlToValidate = calendarControl.ClientIDWrapper;
            base.OnInit(e);
        }
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!Page.IsPostBack)
            {
                calendarControl.MaxDate = DateTime.Today;
                calendarControl.SelectedDate = DateTime.Today;
            }
        }

        protected void Save_OnClick(object sender, EventArgs e)
        {
            if (!Page.IsValid)
                return;
        }

paul
Top achievements
Rank 1
 answered on 14 Oct 2011
1 answer
164 views
I am sure I am missing something simple here.

I have created a function to call a storeproc and want to return the results to a listbox:

Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    rgd_CurrentGroups.DataSource = GetGroups()
    rgd_CurrentGroups.DataBind()
    RadListBox1.DataSource = GetGroups().DefaultView
    RadListBox1.DataBind()
End Sub
Private Function GetGroups() As DataTable
    'Dim UserName As String = Request.QueryString("UserName")
    Dim UserName As String = "fred"
    Dim connectionString As String = DirectCast(ConfigurationManager.ConnectionStrings("IT_CentralConnectionString").ConnectionString, String)
    Dim connection As New SqlConnection(connectionString)
    Dim command As New SqlCommand(connectionString, connection)
    command = New SqlCommand("procGetGroupUsers", connection)
    command.CommandType = CommandType.StoredProcedure
    command.Parameters.Add("@UserName", SqlDbType.VarChar).Value = UserName
    command.Connection.Open()
    Dim myDataAdapter As New SqlDataAdapter(command)
    Dim myDataSet As New DataSet
    Dim dtData As New DataTable
    myDataAdapter.Fill(myDataSet)
    Return myDataSet.Tables(0)
    command.Connection.Close()
End Function

If I use a radgrid the grid populates correctly but if I use a listbox the funtion only returns system.data.datarowview.

Can some one please set me straight.

Thank you.


Allan
Top achievements
Rank 2
 answered on 14 Oct 2011
1 answer
57 views
How can i graph 2 different series against the samy y-axis. I have been able to successfully do 2 series, on the y-axis and secondary y-axis, but now I'd like to have them scaled on the same y-axis.
Becky Bryda
Top achievements
Rank 1
 answered on 14 Oct 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?