Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
136 views

Dear All,

I’m setting the visibility of the command item (Hyper Link)in the command item template (Add New Record) on the grid pre render event based on logged in user permissions.

The code used is shown below: 

foreach (GridItem Item in grdUsers.MasterTableView.GetItems(GridItemType.CommandItem))     
                {     
                    GridCommandItem CommandItem = (GridCommandItem)Item;     
                    LinkButton InitLinkButton = (LinkButton)CommandItem.FindControl(functionalitiesRow.ControlName);     
    
                    if (InitLinkButton != null)     
                    {     
                        InitLinkButton.Visible = false;     
                        break;     
                    }     
    
    
                } //End for each    
 


The problem is that when I do reordering for the column on the server side the code in grid pre render even is executed and the Hyper Link visibility is set to false but when the page appears the (Add New Record) hyper link is visible to the user and s/he can click on it.

This problem only appears on the reordering columns functionality.

I don’t want to reorder the column on client side, because am preserving the grid state and columns order for the logged in user.

Any suggests to my problem?

Taiseer
Top achievements
Rank 1
 answered on 08 Nov 2009
2 answers
167 views
Hello,

I have a two listboxes that I use to transfer items from one to another. On my destination listbox I want to set one item as a default item.
I have decided to add a button that will take the selected item and set an image to it to indicate that this item is the default one.

I have done so using javascript:

function setDefaultReport() {  
                selectedReportsList.trackChanges();  
                var selectedItem = selectedReportsList.get_selectedItem();  
                if (selectedItem) {  
                    if (defaultReport) {  
                        defaultReport.set_imageUrl("");  
                        }  
                    }  
                    selectedItem.set_imageUrl("/images/icon.gif");  
                    defaultReport = selectedItem;  
                }  
                selectedReportsList.commitChanges();  
            } 

When I push the button to run this function I get an invalid argument error during runtime of the script. It happens in the insertBefore function of the current list item.

Any ideas?

Thanks,
Oded
Oded
Top achievements
Rank 1
 answered on 08 Nov 2009
4 answers
382 views
I have been struggling with putting the combo into a grid and doing a client side autocomplete for a day now.  I dont see any samples on this which makes me wonder if no one is doing this.

Here is what I am trying to do:  I have grid that is bound to a datatable server side, in the datatable there are two related columns ClassID, Class.  These are are really one data value for a lookup. I have a template column defined as follows.

<telerik:GridTemplateColumn HeaderText="Class" UniqueName="Class" SortExpression="Class" ShowSortIcon="true" HeaderStyle-Width="200">     
    <ItemTemplate>    
        <asp:Label ID="Label1" runat="server" Text='<%# Eval("Class") %>' /> 
    </ItemTemplate>   
    <EditItemTemplate>    
        <telerik:RadComboBox ID="ClassCombo" runat="server" Width="190px" Height="200px" MarkFirstMatch="true" 
            OnClientItemsRequested="OnClientItemsRequested" OnClientItemsRequesting="OnClientItemsRequesting" OnClientDropDownClosed="OnClientDropDownClosed"   
            OnClientSelectedIndexChanged="OnClientSelectedIndexChanged" 
            EnableLoadOnDemand="true" AllowCustomText="false" > 
            <ExpandAnimation Type="none" /> 
            <CollapseAnimation Type="none" /> 
            <WebServiceSettings Path="/Lookup.asmx" Method="Classes"  /> 
        </telerik:RadComboBox> 
    </EditItemTemplate>   
</telerik:GridTemplateColumn> 

Here is the javascript for lookups:
function OnClientItemsRequesting(sender, args){  
    startTime = new Date();  
}  
 
function OnClientItemsRequested(sender, args){  
    var endTime = new Date();  
}  
 
function OnClientSelectedIndexChanged(sender, args) {  
    var item = args.get_item();  
    var text = item.get_text();  
    var val = item.get_value();  
 
     alert(val);  
}  
              
              
function OnClientDropDownClosed(sender, args)  {
  
    sender.clearItems();  
                  
    if(args.get_domEvent().stopPropagation)  
        args.get_domEvent().stopPropagation();  
} 

The lookup service works just fine, if you type in the box it pulls back matching rows and displays them in the combo and I can select the item. 

The two things I cannot figure out. 
1. How to populate the combo with the initial value, I could do this server side when the edit postback comes in.

2. This is the big one as I cannot figure out a workaround.  How do I get the value of the selected item back into the form field on the client?  In my code, I put the statement alert(val);  in the selection and that has the correct value in it when an item is selected; I just cant figure out how to get it into the form field. 

None of the samples show a client side autocomplete combo populated by a service inside of a grid. 


Mike
Top achievements
Rank 1
 answered on 07 Nov 2009
1 answer
283 views
I resolved this issue myself; Just in case anybody else runs into the same problem, I'll post it here...

I created a user control and a RadAjaxManager for Ajax support.  The RadAjaxLoadingPanel was not showing up on Ajax operations.  So I decided to manually show/hide the loading panel by using RadAjaxManager.ClientEvents.  However, OnRequestStart and OnResponseEnd were not being triggered for some reason.  So I hooked into the Sys.WebForms.PageRequestManager instance and added a listener for beginRequest and endRequest.

So I got that working and tried to show the RadAjaxLoadingPanel.  That's when I realized the problem.  RadAjax was trying to reference my user control client-side using ClientID.  However, I inherit from System.Web.UI.UserControl which does not have a wrapper containing the control ClientID.  So there was nothing to reference in the generated HTML.  After wrapping my user control in a div with its ClientID, RadAjaxManager.ClientEvents began to throw the OnRequestStart and OnResponseEnd events correctly, and the RadAjaxLoadingPanel worked without additional coding on the client-side.

I don't know if this is the best way, but this is the code I used to resolve this issue:
    Public Overrides Sub RenderControl(ByVal writer As System.Web.UI.HtmlTextWriter) 
        writer.AddAttribute(HtmlTextWriterAttribute.Id, Me.ClientID) 
        writer.RenderBeginTag(HtmlTextWriterTag.Div) 
        MyBase.RenderControl(writer) 
        writer.RenderEndTag() 
    End Sub 

Hope this helps!
Joe
Top achievements
Rank 2
 answered on 07 Nov 2009
0 answers
151 views
Hello Telerik Team ,

I haven't used Radwindow much . And i have a requirement where i need to read the HTML content of the Url opened in Radwindow . 

I know i can do that using HTTP request  but in my case due to Security reasons i cant Bypass the Login screen , so the user first log in with credentials and then i need to read the html content of RadWindow .  I am pretty sure this can be done but i dont seem to find a way . 

Please suggest a way so that i can do that on server side button click event . 

Thank You
Vipin Ajmera
Vipin
Top achievements
Rank 1
 asked on 07 Nov 2009
2 answers
128 views
Hi all,
 For the javascript validations i am using the Rad alert instead of using browsers default alert.
Now i am facing the problem under the ModalPopupExtender i am having text boxes and when i am clicking on the "Submit" button i have to get the rad alert that "Please enter a value". But the rad alert is firing but it is behind the ModalPopupExtender.


My question clearly meant : I want the rad alert above the ModalPopupExtender .


Waiting for the reply...

ThanQ,
Vara Prasad.M

prasad
Top achievements
Rank 2
 answered on 07 Nov 2009
1 answer
144 views
The DestroyOnClose property seems to be ignored (treated as always FALSE) with the latest Q3 release (downloaded this morning).

Pages that worked fine prior to upgrading to Q3, now load and display every RadWindow that the page has ever displayed, on postback. So if I click a button to display a window then close it and click the button again, it will display 2 copies of the window. If I close it and click the button again, it will display 3 copies of the window (and so on). This behavior occurs with RadGrid popup windows as well.

      
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="btnCreateAccount">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="lnkPasswordRecovery">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="lnkPrivacy">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="lnkSecurity">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
      
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" 
        DestroyOnClose="true" 
        Behaviors="Close,Move"   
        Modal="false" 
        KeepInScreenBounds="true" 
        VisibleStatusbar="false"    
        VisibleOnPageLoad="true" 
        Animation="None"        
        > 
    </telerik:RadWindowManager> 
     

As various buttons are clicked, I add RadWindows to the RadWindowManager in the codebehind (typically just setting NavigateUrl, Height, and Width).

        Dim rw As New RadWindow  
        With rw  
            .NavigateUrl = NavigateUrl  
            .Height = Height  
            .Width = Width  
        End With 
 
        ' Add it to the RadWindowManager's Windows collection  
        rwManager.Windows.Add(rw)  

So if I click a button that loads a RadWindow, close the Window, then click the button again it will display BOTH the first window and the second. Even the overlay gets loaded multiple times.

Like I mentioned, this works perfectly with Q2, the behavior is consistent on all my pages that use the RadWindow. Please advise, thanks!
KDL
Top achievements
Rank 1
 answered on 07 Nov 2009
5 answers
392 views
Hi,
  Few questions about the expand/collapse button in hierarchical grid.
  1.  Is there a way to move the expand/collapse button to the right side of the grid?
  2.  If there is no way to move it, then is there a way to make it invisible?
  3.  I manually added a GridExpandColumn column to my grid, but I got this error message.  Please help me fix it.
    Multiple controls with the same ID 'GECBtnExpandColumn' were found. FindControl requires that controls have unique IDs.


Thanks.
Yuvika
Top achievements
Rank 1
 answered on 07 Nov 2009
7 answers
331 views
I running into a problem whereby the Skin styles are not applied to a DatePicker control.The effect is that the calendar cannot be opened (even though it shows my icons which are set manually). The DatePicker is on a custom UserControl used for editing a RadGrid which itself is on a page with a DesignMaster. The RadGrid has the Office2007 skin applied by virtue of a .skin file and theme.

<telerik:RadGrid ID="ValueGrid" runat="server" AutoGenerateColumns="False" 
    Width="100%" GridLines="Horizontal" 
    AllowAutomaticDeletes="true" AllowAutomaticInserts="false" AllowAutomaticUpdates="false"  
    OnNeedDataSource="ValueGrid_NeedDataSource" 
    OnItemDataBound="ValueGrid_ItemDataBound"  
    OnDeleteCommand="ValueGrid_DeleteCommand"  
    OnInsertCommand="ValueGrid_InsertCommand"  
    OnUpdateCommand="ValueGrid_UpdateCommand"> 
    <MasterTableView DataKeyNames="Key" CommandItemDisplay="Top" 
        NoMasterRecordsText="No additional info data for this contract." 
        ShowHeadersWhenNoRecords="true"> 
        <Columns> 
            <telerik:GridButtonColumn CommandName="Edit" ButtonType="ImageButton" Text="Edit"  
                UniqueName="EditCommandColumn" 
                ImageUrl="~/App_Themes/Default/buttons/grid_edit.jpg"> 
                <HeaderStyle Width="20px" /> 
            </telerik:GridButtonColumn> 
 
            <telerik:GridTemplateColumn DataField="Attribute" HeaderText="Type"> 
                <HeaderStyle Width="100px" /> 
                <ItemStyle Width="100px" /> 
                <ItemTemplate> 
                    <asp:Literal ID="AttributeLabel" runat="server"  
                        Text='<%#DataBinder.Eval(Container, "DataItem.Attribute.Name") %>' /> 
                </ItemTemplate> 
            </telerik:GridTemplateColumn> 
 
            <telerik:GridTemplateColumn HeaderText="Value"> 
                <HeaderStyle Width="300px" /> 
                <ItemStyle Width="300px" /> 
                <ItemTemplate> 
                    <asp:Literal ID="ValueLabel" runat="server"  
                        Text='<%# ((AttributeValue)DataBinder.Eval(Container, "DataItem")).DisplayMarkup %>' /> 
                </ItemTemplate> 
            </telerik:GridTemplateColumn> 
 
            <telerik:GridBoundColumn DataField="Note" HeaderText="Note"> 
                <HeaderStyle Width="150px" /> 
                <ItemStyle Width="150px" /> 
            </telerik:GridBoundColumn> 
 
            <telerik:GridButtonColumn ButtonType="ImageButton" UniqueName="DeleteColumn" CommandName="Delete" 
                ImageUrl="~/App_Themes/Default/buttons/grid_delete.jpg"  
                ConfirmText="<%$Resources:AvailsResources, DeleteConfirmationGeneral%>"> 
                <HeaderStyle Width="20px" /> 
            </telerik:GridButtonColumn> 
        </Columns> 
        <CommandItemSettings AddNewRecordText="Add" /> 
        <EditFormSettings  
            UserControlName="~/Controls/AttributeValueEdit.ascx"  
            EditFormType="WebUserControl" > 
            <EditColumn ButtonType="ImageButton"  
                InsertImageUrl="~/App_Themes/Default/buttons/grid_add.jpg"  
                UpdateImageUrl="~/App_Themes/Default/buttons/grid_update.jpg" 
                CancelImageUrl="~/App_Themes/Default/buttons/grid_cancel.jpg"> 
            </EditColumn> 
        </EditFormSettings> 
    </MasterTableView> 
</telerik:RadGrid> 

Here is the UserControl markup:
<table class="standardTable"> 
    <colgroup> 
        <col width="80px" /> 
        <col width="100%" /> 
    </colgroup> 
    <tr> 
        <td> 
            <asp:Label ID="AttributeLabel" runat="server" meta:resourcekey="AttributeLabel" /></td> 
        <td> 
            <asp:DropDownList ID="AttributeEdit" runat="server" AutoPostBack="True"  
                Width="200px" 
                DataValueField="Key" DataTextField="Name" 
                OnSelectedIndexChanged="AttributeEdit_SelectedIndexChanged"> 
            </asp:DropDownList> 
        </td> 
    </tr> 
    <tr> 
        <td> 
            <asp:Label ID="ValueLabel" runat="server" meta:resourcekey="ValueLabel" /> 
        </td> 
        <td> 
            <telerik:RadDatePicker ID="ValueDateEdit" runat="server" Width="104px" Skin="Web20"> 
                <Calendar ID="ValueDateCalendar" runat="server" Skin="Web20"> 
                </Calendar> 
                <DateInput runat="server" EnabledStyle-HorizontalAlign="Right" Skin="Default" MinDate="1900-01-01" DateFormat="<%$ SystemSetting:ShortDatePattern %>" /> 
                <DatePopupButton ImageUrl="~/App_Themes/Default/icons/icon_datePickerPopup.gif"  
                    HoverImageUrl="~/App_Themes/Default/icons/icon_datePickerPopupHover.gif" /> 
            </telerik:RadDatePicker> 
        </td> 
    </tr> 
    <tr> 
        <td> 
            <asp:Label ID="NoteLabel" runat="server" meta:resourcekey="NoteLabel" /></td> 
        <td> 
            <asp:TextBox ID="NoteEdit" runat="server" Width="150px" /> 
        </td> 
    </tr> 
    <tr> 
        <td colspan="2"> 
            <asp:Button ID="SaveButton" runat="server" CommandName="Update" meta:resourcekey="SaveButton" /> 
            <asp:Button ID="CancelButton" runat="server" meta:resourcekey="CancelButton" 
                CausesValidation="False" CommandName="Cancel" /> 
        </td> 
    </tr> 
</table>  

The style "standardTable" is defined as follows:
table.standardTable 
{ 
    table-layout    :   fixed; 
    border      :   none 0px; 
    border-collapse :   collapse; 
    border-spacing  :   0px; 
} 
table.standardTable select, table.standardTable input 
{ 
    font            :   menu; 
} 
 

Anupam Godbole
Top achievements
Rank 1
 answered on 06 Nov 2009
1 answer
167 views
(Q2 2009)
Hi, my new issue is, how can i show a popup window from my hyperlinks of my radgrid, i'm triying to call another aspx but in a popup window. thanks

protected void tk_Grid_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
 if (e.Item is GridDataItem) 
        { 
            GridDataItem dataItem = (GridDataItem)e.Item; 
 
            HyperLink h1 = new HyperLink(); 
            h1.NavigateUrl = "frmAnexoBalance.aspx?Periodo=APERTURA&MesID=0&TCID=0&GGPPID=" + dataItem["FormatoGananciaPerdidaID"].Text.Trim() + "&FBID=0";             
            //h1.Target= "blank"; 
            h1.Text = dataItem.GetDataKeyValue("Apertura").ToString(); 
            h1.CssClass = "gridtext";             
            dataItem["Apertura"].Controls.Add(h1); 

Regards Gino.


Schlurk
Top achievements
Rank 2
 answered on 06 Nov 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?