Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
100 views

I am having issues when using an edit template to create a new record. On insert, the same binding is assumed and does not work as there is nothng to bind to. For example, I have a date picker for which I have resricted the range from 2011 to 2050. On insert, there is no value being passed in and so an exception raised (Object cannot be cast from DBNull to other types.)
e.g.

<td>

 <asp:CheckBox ID="Critical_E" runat="server" Text="Critical" Checked='<%# DataBinder.Eval( Container, "DataItem.Critical" ) %>' />

 </td>


How do I either 1) disable the binding on insert, 2) create a separate insert template without having to create user controls?

Thanks,

Neil.

Veli
Telerik team
 answered on 02 Feb 2012
4 answers
552 views
Hi,

I have two related comboboxes here in Edit Form Template . and OnSelectedIndexChanged Loads the Items in the second ComboBox.

This Code works Fine on Insert Mode but on Edit Mode it Can't see the ComboBoxes ( return Nothing ):

Protected Sub CustomerName_SelectedIndexChanged(ByVal o As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs)
 
 
        Dim editedItem As GridEditFormItem = DirectCast(rgOpportunities.MasterTableView.GetItems(GridItemType.EditFormItem)(0), GridEditFormItem)
        
        Dim CustomerCombo As RadComboBox = DirectCast(editedItem.FindControl("rcbCustomerName"), RadComboBox)
        Dim ContactsCombo As RadComboBox = DirectCast(editedItem.FindControl("rcbContactName"), RadComboBox)
 
        If (CustomerCombo.DataSourceID IsNot Nothing) Then
            CustomerCombo.DataSourceID = String.Empty
        End If
        ContactsCombo.DataSource = LoadContacts(e.Value)
        'ContactsCombo.Items.Clear()
        ContactsCombo.OpenDropDownOnLoad() = True
        ContactsCombo.DataBind()
        If ContactsCombo.Items.Count > 0 Then
            Session("ContactID") = ContactsCombo.Items(0).Value
        Else
            Session("ContactID") = ""
        End If
 
 
    End Sub


--- > CustomerCombo and ContactsCombo Access the edit form and gets the RadComboBoxes and Works Fine in InsertMode
But in Edit Mode , Iam not able to Access The editform and get controls by this way or any other way !

Can anyone helps me in this Please ( Urgent ).
Mahmoud
Top achievements
Rank 1
 answered on 02 Feb 2012
1 answer
108 views
How to set colour for emptymessage and show the text in normal font?
Princy
Top achievements
Rank 2
 answered on 02 Feb 2012
11 answers
285 views
Hello Telerik,

I have seen all kinds of ways to code for changing up column types, setting data bound combos, etc. But what is the proper procedure for changing up a column in code-behind. In other words, which procedures are suppose to use for changing up things. 

Here is the scenario:

I have a grid with AutoGenerated fields from a code behind data tier that returns a data table for a grid. Now this data may need a mask, or a drop down combo, or a numeric text control for UI enhancements in the grid. Here would be a typical grid for this scenario in the mark-up:

<telerik:RadGrid runat="server" ID="RadGrid1" AllowMultiRowSelection="true" AllowMultiRowEdit="true" EnableViewState="true" ViewStateMode="Enabled">
 
<MasterTableView DataKeyNames="ProgramPhoneListId, ProgramId, IsPrimary, AliasName, PhoneNumber, Extension, PhoneTypeValuesId" ClientDataKeyNames="ProgramPhoneListId, ProgramId, IsPrimary, AliasName, PhoneNumber, Extension, PhoneTypeValuesId" NoMasterRecordsText="Please click the 'Add' button to add a phone number..." EditMode="InPlace" AutoGenerateColumns="true" TableLayout="Fixed">
 
<Columns>
<telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" CommandName="Select" />
</Columns>
 
</MasterTableView>
 
<ClientSettings EnableRowHoverStyle="true">
<Selecting AllowRowSelect="true" />
<Scrolling AllowScroll="true" UseStaticHeaders="true" />
</ClientSettings>
 
</telerik:RadGrid>

Now what events would be needed in the code-behind for changing things up to use the UI enhancements as I mentioned above. For instance: (in order of firing precedence)

DataBinding:
I use this for "EditIndexes" on the grid, no problems here with what is supposed to be here.

ColumnCreated:
Its works for changing the header, style, text, width, etc., but what if 'PhoneTypeValuesId' is just integers and needs another data table for its data. Do I need to change it to a GridBoundColumn in this event? If 'PhoneNumber' needs a mask to I change it to a RadMaskedColumn in this event and add the DisplayMask - "(###) ###-####" ? 

ItemCreated:
Ok, this is when the rows are created and gets fired for each row if I am not mistaken. So in this event you can cast GridItems to RadMaskedTextBox, RadNumericTextBox and others, but do you have to if you set the columns up in the ColumnCreated event? When I try to change the type to a RadMaskedTextBox it errors out unable to cast type of the TextBox to RadMaskedTextBox. Now is this because something else has to happen to the cell? What about the drop down in this event? Do you change the cell to a RadComboBox? 

ItemDataBound:
This event can fill in my GridDropDownColumn, but what needs to be setup before this? When the GetColumnEditor of the 'PhoneTypeValuesId' is trying to change the type to a GridDropDownColumnEditor it again fails on the cast object of type. I feel like something is supposed to be done before this tries to add the datasource, datatextfield, etc. to the GridDropDownColumnEditor, if it can't change the type this will not work. 

PreRender:
Basically I use this to change up the controls in the grid properties, width, borderstyle, etc. Also used to attach attributes for events to the TextBox for editing. No real issues here. 

Now I've been through the documentation and it wasn't in too much detail with different scenarios, it was a lot of mark-up usage which doesn't apply much to my situation.

Can someone please elaborate on this and maybe a small example of what should get put into each event? How to achieve the desired results in the grid. I really appreciate it!

SDI
Tsvetina
Telerik team
 answered on 02 Feb 2012
3 answers
124 views
I deployed the version 5. 812 of radeditormoss.wsp and it seems to deploy fine.  but when I go to my website that I deployed it to I get this following message.  Any suggestions?



This page has encountered a critical error. Contact your system administrator if this problem persists.
Stanimir
Telerik team
 answered on 02 Feb 2012
3 answers
89 views
Hi Friends,

I have an requirement to display grid rows as columns which should be separated by slider control.

Is there any sample to solve this problem?

Appreciate for any answer.


Naresh.
Shinu
Top achievements
Rank 2
 answered on 02 Feb 2012
1 answer
172 views
Hi,

               I have default button in my webpage.

Page.Master.Page.Form.DefaultButton = btnEnter.UniqueID;

             I entered some text on  policy id and click on enter button,it should bind mygrid which is in ajaxpanel.

             when i click on enter button,it is firing the event..but it is unable to find the radgrid.

<telerik:RadAjaxPanel ID="RadAjaxPanel1" LoadingPanelID="RadAjaxLoadingPanel1" runat="server">
//My Grid....

</telerik:RadAjaxPanel>


          I have more than one textboxes and if i entered text on any one of the textbox and click on enter button,i shouldget the grid with the latest result..

           i tried all forum thread solutions..

can u please provide new one..ASAP..

Thanks,
PANDU


 

Marin
Telerik team
 answered on 02 Feb 2012
4 answers
160 views
I have a grid template column, which is an icon, and on mouseover should show the picture as a tooltip. It works fine with IE, but with FireFox, it sometimes shows the tooltip for top two rows, and for the rest it does not. The grid has paging, and when you come back to the first page, it does not show tooltips at all, for which it was showing before. Its the second column in the grid. I am attaching only that part of the code which deals with the RadToolTipManager

version : RadControls for ASP.NET AJAX Q1 2008


ASPX Code :

<

telerik:RadToolTipManager runat="server" ID="RadToolTipManager1" RelativeTo="Element" Animation="None" OnAjaxUpdate="OnAjaxUpdate" AutoCloseDelay="2000" HideDelay="0" ShowCallout="false" Position="MiddleRight" ShowDelay="0" ContentScrolling="Auto" ShowEvent="OnMouseOver" Visible="true" Style="display: none;">

 

 

</telerik:RadToolTipManager>

 

<

telerik:RadGrid ID="RadGridMain" runat="server" AllowPaging="True" AutoGenerateColumns="False" OnItemEvent="RadGridMain_ItemEvent" OnNeedDataSource="RadGridMain_NeedDataSource" OnItemDataBound="RadGridMain_ItemDataBound">

 

 

 

 

<MasterTableView>

 

 

 

 

<RowIndicatorColumn Visible="False">

 

 

 

 

<HeaderStyle Width="20px" />

 

 

 

 

</RowIndicatorColumn>

 

 

 

 

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

 

 

 

 

<HeaderStyle Width="20px" />

 

 

 

 

</ExpandCollapseColumn>

 

 

 

 

<Columns>

 

 

 

 

<telerik:GridTemplateColumn UniqueName="Detail">

 

 

 

 

<ItemTemplate>

 

 

 

 

<sis:WebButton ID="WebButtonDetail" runat="server" ImageUrl="~/App_Themes/LBL/wbtnDetail_small.gif" IsSmallButton="true" UseCssHover="true" AutoTipKey="Detail" OnCommand="WebButtonDetail_OnCommand" CommandArgument='<%# Eval("StudentDBN") %>' />

 

 

 

 

</ItemTemplate>

 

 

 

 

</telerik:GridTemplateColumn>

 

 

 

 

<telerik:GridTemplateColumn HeaderText="Photo" UniqueName="Photo">

 

 

 

 

<ItemTemplate>

 

 

 

 

<sis:WebButton ID="WebButtonCamera" runat="server" ImageUrl="~/App_Themes/LBL/wbtnCamera.gif" UseCssHover="true" />

 

 

 

 

</ItemTemplate>

 

 

 

 

</telerik:GridTemplateColumn>



C# Code :

 

protected

void Page_Load( object sender, EventArgs e ) {

 

 

 

 

if

( Page.IsPostBack == false ) {

 

 

this.RadToolTipManager1.TargetControls.Clear();

 

 

}

 

protected

void RadGridMain_ItemDataBound( object sender, GridItemEventArgs e ) {

 

 

 

 

if

( e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item ) {

 

WebButton

photoBtn = e.Item.Cells[3].FindControlRecursive<WebButton>();

 

 

 

 

if

(photoBtn != null){

 

photoBtn.Visible = btnVisible;

 

if (btnVisible)

 

{

photoBtn.ID = sum.StudentDBN +

".jpg";

 

 

this.RadToolTipManager1.TargetControls.Add(photoBtn.ClientID, true);
} } }

 

 


 

 

protected

void OnAjaxUpdate( object sender, ToolTipUpdateEventArgs args ) {

 

 

int start = args.TargetControlID.LastIndexOf( "_" );

 

 

string im = args.TargetControlID.Substring( start + 1 );

 

 

Image image = new Image();

 

image.ImageUrl = im;

image.ImageUrl =

"Images/GetImage.ashx?s=" + im;

 

 

if ( image.Height.Value > 200 ) {

 

image.Height = 200;

}

args.UpdatePanel.ContentTemplateContainer.Controls.Add( image );

 

int index = args.TargetControlID.LastIndexOf( "_" );

 

 

string elementID = args.TargetControlID.Substring( index + 1 );

 

 

this.UpdateToolTip( elementID, args.UpdatePanel );

 

}

 

private void UpdateToolTip( string elementID, UpdatePanel panel ) {

 

 

Control ctrl = Page.LoadControl( "Controls/StudentPhotoPopup.ascx" );

 

panel.ContentTemplateContainer.Controls.Add( ctrl );

 

//

 

 

 

 

 

}

 


Thanks,

Brenda

Aditya
Top achievements
Rank 1
 answered on 02 Feb 2012
5 answers
145 views
RadEditor for MOSS was working fine till yesterday and all of a sudden the control is disabled. We are not able to edit/add content. This is affecting all the site in the server. Any ideas why this is happening?

The control is grayed out and I am not able to click in the content area for the toolbar to show.
Rumen
Telerik team
 answered on 02 Feb 2012
1 answer
79 views

Hello,

 I'm testing the controls and I found that the RadComboBox, when the state is Disabled, in chrome with the skin of Windows7, the selected item is not visible.
I could indicate how this problem is solved.

Thank you,

Sorry for my English.

Kate
Telerik team
 answered on 02 Feb 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?