Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
674 views
Hello,

I have an issue where the drop down list for my radcombobox needs to open to the left instead of the right.  At this moment, the list is extended past the right hand side of my window.  Is there a property setting that can easily take care of this?  I have tried the OffsetX and OffsetY properties but the dropdown still not move past the left-most position of the combobox. 

Thanks,
Rick
 
troyski8
Top achievements
Rank 1
 answered on 30 Sep 2009
2 answers
158 views

I've created a grid where I edit the data InPlace.  The grid has just one editable column and when I press Enter/Return I want the row to save.  This seems to be partly working without me having to code it but only if I am editing row 1 on the grid (or the add new line if inserting a new record).  If I edit row 2 or more then it's not saving my row and instead just moves the focus to row 1 on the grid!

The grid is created entirely with code.  Here it is...

default.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title></title>  
</head> 
<body> 
    <form id="form1" runat="server">  
      
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX="true" DefaultLoadingPanelID="AjaxLoadingPanel1"></telerik:RadAjaxManager> 
    <telerik:RadAjaxLoadingPanel id="AjaxLoadingPanel1" runat="server" ></telerik:RadAjaxLoadingPanel>   
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager> 
    
    <div> 
        <asp:Panel ID="pnlContent" runat="server">  
    
        </asp:Panel> 
    </div> 
      
    </form> 
</body> 
</html> 
 

default.aspx.vb

Imports Telerik.Web.UI  
 
Partial Public Class _Default  
    Inherits System.Web.UI.Page  
 
    Protected WithEvents grdCategories As New RadGrid  
    Protected WithEvents sqlDataSource As New SqlDataSource  
 
    Private Function CreateRadGridBoundColumn(ByVal Datafield As StringOptional ByVal Width As Integer = 0) As GridColumn  
 
        Dim col As New GridBoundColumn  
        With col  
            .AllowSorting = True 
            .DataField = Datafield  
            .HeaderText = Datafield  
            .UniqueName = Datafield  
 
            If Width = 0 Then 
                .HeaderStyle.Width = (Len(.HeaderText) * 8) + 32  
            Else 
                .HeaderStyle.Width = Width + 16  
            End If 
        End With 
 
        Return col  
 
    End Function 
 
    Protected Sub Page_Init(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Init  
 
        SetGridSettings()  
 
    End Sub 
 
    Private Sub grdCategories_ItemCreated(ByVal sender As ObjectByVal e As Telerik.Web.UI.GridItemEventArgs) Handles grdCategories.ItemCreated  
 
        If (TypeOf e.Item Is GridDataInsertItem AndAlso e.Item.IsInEditMode) Then 
            Dim InsertItem As GridDataInsertItem = DirectCast(e.Item, GridDataInsertItem)  
 
            Dim CategoryTextBox As TextBox = DirectCast(InsertItem("CategoryName").Controls(0), TextBox)  
            CategoryTextBox.MaxLength = 25  
            CategoryTextBox.Width = 450  
            CategoryTextBox.Focus()  
        ElseIf (TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode) Then 
            Dim EditItem As GridEditableItem = DirectCast(e.Item, GridEditableItem)  
 
            Dim CategoryTextBox As TextBox = DirectCast(EditItem("CategoryName").Controls(0), TextBox)  
            CategoryTextBox.MaxLength = 25  
            CategoryTextBox.Width = 450  
            CategoryTextBox.Focus()  
        End If 
 
    End Sub 
 
    Protected Sub SetGridSettings()  
 
        With sqlDataSource  
            .ID = "SqlDataSource" 
            .ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString  
            .SelectCommandType = SqlDataSourceCommandType.Text  
            .SelectCommand = "SELECT CategoryID, CategoryName FROM Categories" 
            .DeleteCommandType = SqlDataSourceCommandType.StoredProcedure  
            .DeleteCommand = "DeleteCategory" 
            .InsertCommandType = SqlDataSourceCommandType.StoredProcedure  
            .InsertCommand = "InsertCategory" 
            .UpdateCommandType = SqlDataSourceCommandType.StoredProcedure  
            .UpdateCommand = "UpdateCategory" 
 
            .InsertParameters.Add("CategoryName", TypeCode.String)  
            .UpdateParameters.Add("CategoryName", TypeCode.String)  
        End With 
 
        pnlContent.Controls.Add(sqlDataSource)  
 
        With grdCategories  
            .ID = "grdCategories" 
            .AllowSorting = True 
            .DataSourceID = "SqlDataSource" 
            .AllowAutomaticDeletes = True 
            .AllowAutomaticInserts = True 
            .AllowAutomaticUpdates = True 
 
            .ShowStatusBar = True 
 
            With .MasterTableView  
                .AutoGenerateColumns = False 
                .AllowMultiColumnSorting = False 
                .EditMode = GridEditMode.InPlace  
 
                .DataKeyNames = New String() {"CategoryID"}  
                .DataSourceID = "SqlDataSource" 
 
                .CommandItemDisplay = GridCommandItemDisplay.Top  
                .TableLayout = GridTableLayout.Fixed  
                .Width = New Unit(100, UnitType.Percentage)  
 
                .Columns.Add(CreateRadGridBoundColumn("CategoryName", 450))  
 
                Dim EditCommand As New GridEditCommandColumn  
                With EditCommand  
                    .ButtonType = GridButtonColumnType.ImageButton  
                    .UniqueName = "EditCommandColumn" 
                    .HeaderStyle.Width = 50  
                End With 
                .Columns.Add(EditCommand)  
 
                Dim DeleteButton As New GridButtonColumn  
                With DeleteButton  
                    .HeaderStyle.Width = 35  
                    .CommandName = "Delete" 
                    .ButtonType = GridButtonColumnType.ImageButton  
                    .ConfirmDialogType = GridConfirmDialogType.RadWindow  
                    .ConfirmText = "Are you sure you wish to delete this category?" 
                    .ConfirmTitle = "Delete Category" 
                End With 
                .Columns.Add(DeleteButton)  
            End With 
        End With 
 
        pnlContent.Controls.Add(grdCategories)  
 
    End Sub 
 
End Class 

Northwind sample script to create my stored procedures:

USE Northwind  
GO  
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DeleteCategory]'and OBJECTPROPERTY(id, N'IsProcedure') = 1)  
drop procedure [dbo].[DeleteCategory]  
GO  
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[InsertCategory]'and OBJECTPROPERTY(id, N'IsProcedure') = 1)  
drop procedure [dbo].[InsertCategory]  
GO  
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UpdateCategory]'and OBJECTPROPERTY(id, N'IsProcedure') = 1)  
drop procedure [dbo].[UpdateCategory]  
GO  
CREATE PROCEDURE [DeleteCategory]  
    (@CategoryID    [int])  
AS   
DELETE [Northwind].[dbo].[Categories]   
WHERE ([CategoryID]  = @CategoryID)  
GO  
CREATE PROCEDURE [InsertCategory]  
    (@CategoryName  [nvarchar](15))  
AS   
INSERT INTO [Northwind].[dbo].[Categories]   
     ([CategoryName],  
      [Description],  
      [Picture])   
VALUES   
    (@CategoryName,  
     NULL,  
     NULL)  
GO  
CREATE PROCEDURE [UpdateCategory]  
    (@CategoryID        [int],  
     @CategoryName  [nvarchar](15))  
AS   
UPDATE [Northwind].[dbo].[Categories]   
SET [CategoryName]   = @CategoryName   
WHERE ([CategoryID]  = @CategoryID)  
GO  

Steps to reproduce (firstly make sure you've a connection to Northwind setup in Web.Config)
1. Click Edit on row 3
2. Change the text
3. Press Enter to try and save the row.  You will see the cursor move to row 1 and the data will not be saved.

Thanks

Chris
Top achievements
Rank 2
 answered on 30 Sep 2009
3 answers
276 views
How would load a RadComboBox from database with HTML Formatting?

Is there a way to perform validation to make sure that user selected a choice from the drop down?

Would you have sample code?

Thank you very much 
Rogério
Top achievements
Rank 2
 answered on 30 Sep 2009
1 answer
83 views
I want to have a multi line text box in my grid, heres how Ive done it

<telerik:GridTemplateColumn UniqueName="TickerColumn" HeaderText="Ticker Text">  
                          
                        <ItemTemplate> 
                            <%#DataBinder.Eval(Container.DataItem,"TickerContent")%> 
                        </ItemTemplate> 
                        <EditItemTemplate> 
                            <telerik:RadTextBox ID="RadTextBoxTickerContent" runat="server" TextMode="MultiLine" MaxLength="500" Rows="5" Width="350px">  
                            </telerik:RadTextBox> 
                              
                        </EditItemTemplate> 
                    </telerik:GridTemplateColumn> 
 
in the insert method I have this code

protected void RadGridTicker_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)  
        {  
              
 
            Telerik.Web.UI.GridEditFormInsertItem insertedItem = (Telerik.Web.UI.GridEditFormInsertItem)e.Item;  
 
            RadComboBox cbPage = (e.Item as GridEditableItem)["ddlDisplayPage"].Controls[0] as RadComboBox;  
            Telerik.Web.UI.RadTextBox tbContent = (insertedItem.FindControl("RadTextBoxTickerContent") as Telerik.Web.UI.RadTextBox);     
 
 
              
            string content = tbContent.Text;  
 
            string res = tickermanager.Add(cbPage.SelectedValue, content);  
 
            if (!string.IsNullOrEmpty(res))  
            {  
                this.RadGridTicker.Controls.Add(new LiteralControl("Unable to insert ticker. Reason: " + res));  
                e.Canceled = true;  
            }  
        } 

stepping through the code shows that an instance of the text box is created, but the text property is null  even though ive typed in several lines of text.  What am I doing wrong here ?
Mira
Telerik team
 answered on 30 Sep 2009
2 answers
166 views
Hello

i am trying to make a RadPanelBar with a behaviour like with ExpandMode="SingleExpandedItem" for all items except the last..
So the last RadItem should always be expanded and the other RadItems should behave like with SingleExpandedItem mode.
Can you please tell me if this possible?

Thanks
Achim
Achim
Top achievements
Rank 1
 answered on 30 Sep 2009
3 answers
364 views
Hello!

I've made a simple site - the same as here:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/listview/defaultcs.aspx

I will explain on example above.

In ItemTemplate i need CustomerID to format hyperlink with this variable.

But I don't want to show CustomerID in header and allow users to sorting and filtering by CustomerID value.

How to do this? The file structure (.aspx and code behind) the same as in link above.

Thanks.



Sebastian
Telerik team
 answered on 30 Sep 2009
1 answer
65 views
I want to use a GridTemplateColumn in my grid, this is how im using it
<telerik:GridTemplateColumn DataField="CastMember" DataType="System.String" HeaderText="Cast Member"    
                        SortExpression="CastMember" UniqueName="CastMember">     
                        <EditItemTemplate> 
                            <telerik:RadTextBox ID="RadTextBoxCastMember2" runat="server" Skin="Vista" Width="250px" MaxLength="100" > 
                            </telerik:RadTextBox>     
                              
                        </EditItemTemplate>    
                    </telerik:GridTemplateColumn>   

when I edit the grid, I want the text box to contain the contents of the underlying datafield, so in my

ItemCreated

event ive puit this code

protected void RadGridCast_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)  
        {  
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)  
            {  
                if (!e.Item.OwnerTableView.IsItemInserted)  
                {  
                      
                    GridEditableItem item = e.Item as GridEditableItem;  
                    RadTextBox tb = (RadTextBox)item.FindControl("RadTextBoxCastMember2");  
 
                      
                      
 
                     
                }  
 
            }  
               
 
        }    

how do I obtain the data to put in the textbox when its in edit mode ???  Ive tried several methods but none of them work.  Can someone give me a working example ?
Daniel
Telerik team
 answered on 30 Sep 2009
8 answers
362 views
is there a way for me to set a back color for a certain row like. row 1 backcolor is red, row 4 pink, row 9 blue.

Also, is there a away to align the column to the right on certain column?. like column1 right, 3 left, 7 right, etc...
Dimo
Telerik team
 answered on 30 Sep 2009
1 answer
137 views
I am having a problem when any ajax call is made from a page that has a special character in the page title.  The title displays correctly when the page loads, but once an ajax call is made the special character is replaced by the character code used to represent the character.  For example, the trademark symbol is shown when the page loads, but &#0153; is shown after the ajax call.  Any suggestions?
Daniel
Telerik team
 answered on 30 Sep 2009
1 answer
178 views
Hello,
I'm trying create grid without pager with vertical scroll.

Please see code below:
 
<radG:RadGrid runat="server" ID="gvMultiUpload" 
              AutoGenerateColumns="false"   
              AllowMultiRowSelection="true" 
              Height="105px" 
              Width="364px">   
                        <MasterTableView Width="100%" TableLayout="Fixed">  
                            <Columns> 
                               <radG:GridClientSelectColumn AutoPostBackOnFilter="false" HeaderStyle-Width="23px" /> 
                                <radG:GridBoundColumn UniqueName="PalletSerialNumber" DataField="PalletSerialNumber" HeaderText="<%$ Resources:GridResource, PalletNum %>" />     
                                <radG:GridBoundColumn UniqueName="TagSerialNumber" DataField="TagSerialNumber" HeaderText="<%$ Resources:GridResource, SensorID %>" />                                 
                                <radG:GridTemplateColumn UniqueName="PalletLocation" HeaderText="<%$ Resources:Resource, lblPalletLocation %>">  
                                     <itemstyle horizontalalign="Center" /> 
                                     <headerstyle horizontalalign="Center" /> 
                                     <itemtemplate> 
                                        <radI:RadNumericTextBox ID="txtPalletLocation" runat="server" Type="Number"  Width="30px"   
                                            MinValue="1" MaxValue="26" 
                                            CssClass="smallTextBox" 
                                            ShowSpinButtons="true">    
                                            <NumberFormat DecimalDigits="0" />    
                                        </radI:RadNumericTextBox>    
                                     </itemtemplate> 
                                </radG:GridTemplateColumn> 
                            </Columns> 
                        </MasterTableView> 
                        <ClientSettings> 
                            <Selecting AllowRowSelect="true" /> 
                            <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True" /> 
                        </ClientSettings> 
                    </radG:RadGrid>      

Attachment is a result of this code!!!

Any ideas?

Thanks a lot

Dimo
Telerik team
 answered on 30 Sep 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?