Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
307 views
I add an image to my hyperlink column from the code behind. Unfortunately it adds the image even if no value for the field is in the database. I would like to hide the image if the value is NULL or empty.

Here is my ASPX column code:

<telerik:GridHyperLinkColumn DataNavigateUrlFields="Email" HeaderText=" "
     DataNavigateUrlFormatString="mailto:{0}"
     UniqueName="Email" AllowFiltering="False" ItemStyle-HorizontalAlign="Center">
 <ItemStyle Width="50px"/>
</telerik:GridHyperLinkColumn>


I have tried:
Private Sub RadGrid_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid2.ItemDataBound
    If (TypeOf e.Item Is GridDataItem) Then
 
        Dim dataItem As GridDataItem = CType(e.Item, GridDataItem)
        Dim hyperlink As HyperLink = CType(dataItem("Email").Controls(0), HyperLink)
        hyperlink.ImageUrl = "../../../images/iconoutlook.gif"
 
        If (dataItem.OwnerTableView.DataKeyValues(dataItem.ItemIndex)("Email") Is System.DBNull.Value) Then
            Dim ltrl As LiteralControl = New LiteralControl(hyperlink.Text)
            dataItem("Email").Controls.Clear()
            dataItem("Email").Controls.Add(ltrl)
        End If
 
    End If
End Sub


Any help appreciated.
Allan
Top achievements
Rank 2
 answered on 28 Mar 2012
2 answers
145 views
Hi everybody!!!

i have a problem using radpagemultiview i have on each radpageview a grid, my problem is in the second radgrid when i use  javascript openRadWindow if i do double click the popup get the correct  path but if i click in the link button using javascript not get the correct path i dont understand why because i wrote correct path

<a href="#" onclick="openRadWindow2('<%#DataBinder.Eval(Container.DataItem,"cod_empleado")%>'); return false;">
                            Imprimir</a>

and my javascript:

<telerik:RadCodeBlock ID="RadCodeBlock4" runat="server">
            <script type="text/javascript">

                function refreshGrid(arg) {
                    if (!arg) {
                        $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
                    }
                    else {
                        $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");
                    }
                }
                function RowDblClick(sender, eventArgs) {
                    window.radopen("Descuentoempleado?cod_empleado=" + eventArgs.getDataKeyValue("cod_empleado"), "UserListDialog");

                }
                function openRadWindow(cod_empleado_) {
                    var oWnd = radopen("Descuentoempleado.aspx?cod_empleado=" + cod_empleado_, "UserListDialog");
                    oWnd.center();
                }
                
            </script>
        </telerik:RadCodeBlock>
i hope anybody can help me thank u very much
Robert
Top achievements
Rank 2
 answered on 28 Mar 2012
5 answers
169 views
Hi Telerik,

I'm having an issue with the RadGrid control.

After resizing my browserwindow my radgrid is being resized.
It changes my height with a few pixels.

I tried debugging the javascript and in the setDataDivHeight function it decides to  remove 17 pixels because Telerik.Web.UI.Grid.getScrollBarHeight() returns 17. But I didn't have a scrollbar!

Currently i'm using Telerik controls version: 2011.2.915.35.

Is there a workaround for this?
Tsvetina
Telerik team
 answered on 28 Mar 2012
1 answer
117 views
Is it possible to change this from the dashed default?  I assume it is just a style, but I cannot locate it.

Thanks,

Steve
Steve
Top achievements
Rank 1
 answered on 28 Mar 2012
2 answers
165 views
Hello,

I currently have RadGrids that I am creating dynamically in Page Load that are embedded in PanelBar Items.  The grids create fine and render on the page.  They have the initial appearance of drag and drop, but when the row is released into the new grid, the routine tied to the RowDrop event (GridRowDrop) does not fire and the Page appears to do a PostBack.  I believe this has to do with something with AJAX settings, but not certain.

Here is a snippet from the code-behind:

Dim SectionGrid As New RadGrid()
 
 With SectionGrid
     .DataSource = GetData(FCTN_TYPE_CD, CALLING_AGENT)
     With .MasterTableView
         .NoMasterRecordsText = "No associates assigned"
         .Columns.Add(New GridDragDropColumn)
     End With
     .Rebind()
 End With
 
 ' Set each grid's properties.
 With SectionGrid
     .ID = "SectionGrid_" & FCTN_TYPE_CD
     .AllowSorting = True
     .Width = Unit.Percentage(99)
     .AutoGenerateColumns = False
     .ShowHeader = False
     .AllowMultiRowSelection = True
     .CssClass = "BottomCorners"
     .Attributes.Add("style", "border:none;")
     With .ClientSettings
         .AllowRowsDragDrop = True
         .Selecting.EnableDragToSelectRows = False
         .Selecting.AllowRowSelect = True
         .ClientEvents.OnRowDropping = "onRowDropping"
         .EnablePostBackOnRowClick = False
     End With
 End With
 
 With SectionGrid.MasterTableView
     .Width = Unit.Percentage(100)
     .DataKeyNames = New String() {"LDAP"}
     .GetColumn("LDAP").Visible = False
 End With
 
 AssignedGrid.Controls.Add(SectionGrid)
 With PanelItem
     .Items.Add(AssignedGrid)
     .Expanded = True
 End With
 
 If SectionGrid.Items.Count = 0 Then PanelItem.Expanded = False
 
 AddHandler SectionGrid.RowDrop, AddressOf GridRowDrop
 AddHandler SectionGrid.NeedDataSource, AddressOf GridNeedDataSource

Any help is appreciated.

regards,

Steve
Steve
Top achievements
Rank 1
 answered on 28 Mar 2012
1 answer
113 views
Hi there,

Am using RadTagCloud.
I have user control on this page with RadTagCloud,  this user control using in my aspx page.
but ItemClick event is giving problem like Object reference not found.

Below find my code snnipet
code behind if UserControl 
public partial class ucCustomerSelector : System.Web.UI.UserControl
  {
    public EventHandler rtcLinksClicks;


    protected void Page_Load(object sender, EventArgs e)
    {
    }


    protected void rtcLinks_ItemClick(object sender, Telerik.Web.UI.RadTagCloudEventArgs e)
    {
      rtcLinksClicks(sender, e);
    }


  }
******************************************
code behind of aspx page
public partial class CustomerPage : System.Web.UI.Page
  {
    


    protected void Page_Load(object sender, EventArgs e)
    {
      
      if (!Page.IsPostBack)
      {
        
        ucCustomerSelector.rtcLinksClicks += new EventHandler(myclick);
      }
    }


    private void myclick(object sender, EventArgs e)
    {
      // my logic wil come here.
    
    }
}
please give me solution, I am waiting for reply.
thanks in advance.
Slav
Telerik team
 answered on 28 Mar 2012
0 answers
134 views

In the popup that opens when I insert or edit one item in the grid, some logic has to be done, for example: enable and disable fields, depending on the values of other fields.

How can I add an onload event for the popup so that I can run js code to perform those enable/disable?

I already tried the OnPopUpShowing event, but it doesn’t work with date pickers, it fails in the get_selectedDate() because the _dateInput is empty (return this._dateInput.get_selectedDate())

Here’s the grid and javascript (simplified):

<RadGrid runat="server" ID="Grid1" AllowPaging="True" GridLines="None" CellSpacing="0" Culture="English (United Kingdom)" AllowSorting="True" AutoGenerateDeleteColumn="True" Width="95%" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" DataSourceID="ControlPanelNotifications_DS">

<MasterTableView DataKeyNames="fldId" DataSourceID="ControlPanelNotifications_DS" EditMode="PopUp" AutoGenerateColumns="False">

<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>

<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>

<Columns>

…

<ItemStyle HorizontalAlign="Center" Width="40px"></ItemStyle>

</sqr:GridButtonColumn>

</Columns>

<EditFormSettings CaptionFormatString="Detalhes" EditFormType="Template">

<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>

<FormTemplate>

<table style="width: 100%;">

<tr>

    <td>

                label

    <td>

                text

    <td>

                Label2

    <td>

                <RadDatePicker runat="server" ID="dtPracticalDate" Width="100px">

          <ClientEvents OnDateSelected="dtPracticalDate_DateSelected" />

        </RadDatePicker >

                <BindableControl runat="server" DataField="PraticalDate" TargetControlID="dtPracticalDate"></BindableControl>&nbsp;</td>

</tr>

<tr>

    <td>

                Label3

    <td>

text

               

     

    </td>

    <td>

                Label4

    <td>

                <RadDatePicker runat="server" ID="dtConfirmationDate" Width="100px">

          <ClientEvents OnDateSelected="dtConfirmationDate_DateSelected" />

        </RadDatePicker >

                <BindableControl runat="server" DataField="ConfirmationDate" TargetControlID="dtConfirmationDate"></BindableControl>&nbsp;</td>

</tr>

</table>

 

<asp:Button runat="server" CommandName="Cancel" Text="Cancelar"></asp:Button>

 

</FormTemplate>

<PopUpSettings Modal="True" Width="570px"></PopUpSettings>

</EditFormSettings>

</MasterTableView>

<FilterMenu EnableImageSprites="False"></FilterMenu>

<ClientSettings>

<ClientEvents OnPopUpShowing="PopUpShowing"></ClientEvents>

</ClientSettings>

<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>

</RadGrid>

Javascript:

function PopUpShowing(sender, eventArgs) {

    var practicalDate = getElementById('dtPracticalDate').get_selectedDate();

    UpdateConfirmationDate22(practicalDate);

}

function UpdateConfirmationDate22(practicalDate) {

    var confirmationDatePicker = getElementById('dtConfirmationDate');

    if (practicalDate != null) {

        confirmationDatePicker.set_enabled(true);

    }

    else {

        confirmationDatePicker.set_enabled(false);

        confirmationDatePicker.clear();

    }

}

David
Top achievements
Rank 1
 asked on 28 Mar 2012
10 answers
506 views
Hi ,


I would like to know what is the difference between the Telerik.WebControls.RadEditor and the Telerik.Web.UI.RadEditor ?

if I will need to change the existing code to use the Telerik.Web.UI.RadEditor instead of the Telerik.WebControls.RadEditor
 how and where can i find the corresponding property of the Telerik.WebControls.RadEditor with the Telerik.Web.UI.RadEditor ?

for example :  Telerik.WebControls.RadEditor.Editable,  DialogParametersMode,  HasPermission etc.

Any sample or documentation will be greatly appreciated


Thanks In Advance








Rumen
Telerik team
 answered on 28 Mar 2012
1 answer
78 views

Hello, 

I'm using Telerik's RadAjaxManager to update panels independently.

On my page, I have 3 user controls: A, B, C.

My AjaxSettings are:

  • If postback on A, update only A.
  • If postback on B, update only B.
  • I declare nothing for C.

If I do a postback on A, I see the loading panel on A, but (using Chrome dev tool) I see data sent for A and B. Strange to me as only A has loading panel.

If I do as postback on B, same behavior: loading panel on B but data for A and B.

Now, if I remove from AjaxSettings the settings for B, when I do a postback on A, only data for A are sent.

Am I wrong, or I should only see data for the "target" panel defined in AjaxSettings?

Moreover, sometimes in our user controls we access the RadAjaxManager to add response script. Can it be related? For instance, if in B's code-behind I add script to RadAjaxManager, will the entire B content will be sent when I do a postback on A (with rule A updates A only)?

This is really an issue in our app.

Thanks in advance for any help.

FB
Top achievements
Rank 1
 answered on 28 Mar 2012
3 answers
243 views
Hi there, I have come across a problem with the Rad Grid shrinking in size when it's rebound, or when it's item command it hit.

I will explain where my grid sits, It is in a control which is situated in a RadWindow which contains a tab strip it is one of the page contols of one of the rad tabs.

The RadGrid is set up with the following code:


    <telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="true" AllowPaging="true" AutoGenerateColumns="true" OnNeedDataSource="RadGrid1_NeedDataSource"
        OnColumnCreated="RadGrid1_ColumnCreated" OnItemDataBound="RadGrid1_ItemDataBound" AllowMultiRowSelection="true" ShowGroupPanel="true" OnItemCommand="RadGrid1_ItemCommand">
        <MasterTableView TableLayout="Fixed" Width="100%">     
            <Columns>
                <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn">
                    <HeaderStyle Width="50px" />
                </telerik:GridClientSelectColumn>
                <telerik:GridButtonColumn DataTextFormatString="Download" UniqueName="DownloadLink" CommandName="Download"
                        runat="server" DataTextField="ID" ButtonType="LinkButton" >                    
                </telerik:GridButtonColumn>                                     
            </Columns>                        
        </MasterTableView>
        <ClientSettings EnableRowHoverStyle="true" AllowDragToGroup="true" AllowColumnsReorder="true">
            <Selecting AllowRowSelect="True" UseClientSelectColumnOnly="true" />      
            <Resizing AllowColumnResize="True" AllowRowResize="false" ResizeGridOnColumnResize="false"
              ClipCellContentOnResize="false" EnableRealTimeResize="false" AllowResizeToFit="false" />                   
        </ClientSettings> 
    </telerik:RadGrid> 

When the page first loads the grid renders as desired, however once it has been updated or the Download command has been run the grid shrinks all columns so that the contents of the cells are spread over 3 lines.

Any ideas on how to stop this from happening?

Regards
Ryan
Andrey
Telerik team
 answered on 28 Mar 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?