Telerik Forums
UI for ASP.NET AJAX Forum
9 answers
117 views
I installed the August 28 hotfix for 2012Q2 to see if a reported display problem with the Menu control using a 2-column submenu had been fixed. When I installed that update, I now see an error instead of a display problem when a submenu is set to 2-column display.

The error occurs in httpErrorPageScripts.js, in function initConnectionStatus(), on the line:
    checkConnection.innerText = L_CONNECTION_ON_TEXT;
The constant L_CONNECTION_ON_TEXT is undefined. The same error occurs for other L_ constants.
Genady Sergeev
Telerik team
 answered on 14 Nov 2012
4 answers
412 views
Hi, 

I tried searching the forum and found a couple of threads, but they didn't help. I have a RadGrid that has another RadGrid nested which also has another nested RadGrid. So there are 3 levels: Level 1 has information about a costumer, level 2 has information about customer´s purchases, and level 3 has info about products that the costumer has bought during the purchase.  

I have a GridClientSelectColumn (and the AllowRowSelect="True" in <ClientSettings>) on the level 2 (the purchases). I can access the selected purchase by iterating trough all items in the whole radgrid and checking which item has its Selected set to true. 

My problem is I cannot figure out how to make it so that only one purhase (level 2 item) could be selected in the whole grid. Right now I can select one purchase per each customer, which is not at all what I want. I guess I should somehow always unselect the previous selection just before selecting the new one.

I tried to subscribe to SelectedIndexChanged of the nested radgrid, but it doesn´t seem to fire. Which event should I use? 

I also found out that this could done with some client side javascript trick, but I am not sure how to do it. Also I would like to do this on the server side if possible...

So what is the "official" way to achieve this "select only one row among nested radgrids" -scenario?
Eyup
Telerik team
 answered on 14 Nov 2012
1 answer
118 views
Hi,
in my radgrid i have a gridimagecolumn. Bound like so
DataImageUrlFields="Status"
DataImageUrlFormatString="~/Content/Images/Status/{0}.gif"

How can i change the image when the database value for Status is DBNULL
if cell.text = DBNULL then
DataImageUrlFormatString="~/Content/Images/Status/waiting.gif"
end if

Thanks
Shinu
Top achievements
Rank 2
 answered on 14 Nov 2012
5 answers
540 views
I am not seeing the button image in a previously working application when I use Telerik version 2012.3.1030.45 (targeting Asp.Net 4.5) or 2012.3.1030.40 (targeting Asp.Net 4.0). I tried both a GridButtonColumn and a GridClientDeleteColumn, and neither one displays the image. Looking at the source code shows the image source attribute is an empty string. The identical code works fine in version 2012.2.724.40.
<telerik:GridClientDeleteColumn UniqueName="TestDeleteColumn"
    HeaderText="Delete" HeaderStyle-Width="45" Text="Delete Invitation"
    ButtonType="ImageButton" ImageUrl="../Images/Delete.gif"
    ConfirmTitle="Delete?" ConfirmDialogType="RadWindow"
    ConfirmTextFields="PersonDisplay" ConfirmTextFormatString="Delete invited speaker {0}?"
    />
  
<telerik:GridButtonColumn UniqueName="DeleteColumn" ButtonType="ImageButton"
    CommandName="Delete" Text="Delete Speaker" ImageUrl="~/Images/Delete.gif"
    HeaderText="Delete" HeaderStyle-Width="45"
    ConfirmTitle="Delete?" ConfirmDialogType="RadWindow"
    ConfirmTextFields="PersonDisplay" ConfirmTextFormatString="Delete invited speaker {0}?"                  
    >
    <ItemStyle HorizontalAlign="Center" CssClass="CursorHand" />
</telerik:GridButtonColumn>

Eyup
Telerik team
 answered on 14 Nov 2012
2 answers
96 views
I am having issues when I use radUpload in the radGrid, I can't insert new records when I use radUpload.

I am using radTabs and Multipage and .ascx files. My radGrid is on user control file.
My code is below

<telerik:RadCodeBlock runat="server" ID="RadCodeBlock1">
 
        <script type="text/javascript">
            var uploadId;
            var AuthorImagesListId;
            //on insert and update buttons click temporarily disables ajax to perform upload actions
            function conditionalPostback(sender, e) {
                var theRegexp = new RegExp("\.UpdateButton$|\.PerformInsertButton$", "ig");
                if (e.EventTarget.match(theRegexp)) {
                    var upload = $find(uploadId);
 
                    //AJAX is disabled only if file is selected for upload
                    if (upload.getFileInputs()[0].value != "") {
                        e.set_enableAjax(false);
                    }
                }
            }
 
        </script>
 
    </telerik:RadCodeBlock
 
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>        
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
 
 <telerik:radprogressmanager id="RadProgressManager1" runat="server" />
 
             
         
<telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticDeletes="True"
    AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowPaging="True"
    AutoGenerateColumns="False" DataSourceID="SqlDataSource1" GridLines="None"
    ShowStatusBar="True" Skin="Hay" AllowSorting="True">
 
    <PagerStyle Mode="NextPrevAndNumeric" />
    <GroupingSettings CaseSensitive="False"></GroupingSettings>
     <%--DOUBLE CLICKING ON GRIDVIEW ROW ACTIVATES THE EDIT ROW MODE--%>          
    <ClientSettings>
                <ClientEvents OnRowDblClick="RowDblClick" />
    </ClientSettings>
    <GroupingSettings CaseSensitive="False" />
    <ClientSettings AllowRowsDragDrop="True">
<ClientEvents OnRowDblClick="RowDblClick"></ClientEvents>
    </ClientSettings>
 
 
<MasterTableView Width="100%" CommandItemDisplay="TopAndBottom" DataKeyNames="nauhaID" DataSourceID="SqlDataSource1" HorizontalAlign="NotSet" AutoGenerateColumns="false" >
    <Columns>
 
        <telerik:GridEditCommandColumn ButtonType="ImageButton" HeaderText="Edit "
            UniqueName="EditCommandColumn1">
            <ItemStyle CssClass="MyImageButton" />
        </telerik:GridEditCommandColumn>
 
        <telerik:GridBoundColumn DataField="title"
            HeaderText="Nauha Title" SortExpression="title" ColumnEditorID="GridTxtboxTemp"
            UniqueName="title">
        </telerik:GridBoundColumn>
 
         
        <telerik:GridDropDownColumn DataField="areaID" DataSourceID="SqlDataSource2"
            HeaderText="Area Name" ListTextField="areaName" ListValueField="areaID"
            UniqueName="column1" ColumnEditorID="GridDropDownColumnEditor1">
        </telerik:GridDropDownColumn>
 
        <telerik:GridBoundColumn DataField="author" HeaderText="author" ColumnEditorID="GridTxtboxTemp" Visible="false"
            SortExpression="author" UniqueName="author">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="lyrics" HeaderText="lyrics" Visible="false"
            SortExpression="lyrics" UniqueName="lyrics">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="reciter" HeaderText="reciter" ColumnEditorID="GridTxtboxTemp"  Visible="false"
            SortExpression="reciter" UniqueName="reciter">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="year" DataType="System.Int16"
            HeaderText="year" SortExpression="year" UniqueName="year">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="format" HeaderText="format"
            SortExpression="format" UniqueName="format">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="duration" DataType="System.TimeSpan" 
            HeaderText="duration" SortExpression="duration" UniqueName="duration">
        </telerik:GridBoundColumn>
 
        <telerik:GridBoundColumn DataField="size" HeaderText="size"
            SortExpression="size" UniqueName="size">
        </telerik:GridBoundColumn>
 
        <telerik:GridBoundColumn DataField="tags" HeaderText="tags" SortExpression="tags" Visible="false"
            UniqueName="tags">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="counter" DataType="System.Int32"
            HeaderText="counter" SortExpression="counter" UniqueName="counter">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="uploader" HeaderText="uploader"
            SortExpression="uploader" UniqueName="uploader">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="date" HeaderText="date" DataFormatString="{0:d}" 
            SortExpression="date" UniqueName="date" DataType="System.DateTime">
        </telerik:GridBoundColumn>
        <telerik:GridCheckBoxColumn DataField="Discontinued" DataType="System.Boolean"
            HeaderText="Discontinued" SortExpression="Discontinued"
            UniqueName="Discontinued" EditFormColumnIndex="1">
        </telerik:GridCheckBoxColumn>
 
         
        <%--TEMPLATE COLUMN FOR UPLOADING--%>
        <telerik:GridTemplateColumn DataField="url" HeaderText="URL New"
            SortExpression="url" UniqueName="urlUpload">
            <EditItemTemplate>
                <telerik:RadUpload ID="RadUpload1" Runat="server" InitialFileInputsCount="1" MaxFileInputsCount="1" maxfilesize="1000000"
                    ControlObjectsVisibility="None" >
                </telerik:RadUpload>
            </EditItemTemplate>
 
            <ItemTemplate>
                <asp:HyperLink ID="HyperLink1" runat="server"
                    NavigateUrl='<%# Eval("url") %>'
                    Text='<%# Eval("title") %>'></asp:HyperLink>
            </ItemTemplate>
        </telerik:GridTemplateColumn>
 
        
       
         
        <telerik:GridButtonColumn ConfirmText=" Are you sure you want to Delete this Nauha?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton"
            CommandName="Delete" Text="Delete"
                        UniqueName="DeleteColumn" HeaderText="Delete">
        </telerik:GridButtonColumn>
 
       
 
 
    </Columns>
     <%--RECORD EDIT/INSERT OPTIONS--%>
<EditFormSettings>
     
 
 
    <EditColumn UniqueName="EditCommandColumn1"></EditColumn>
    <EditColumn ButtonType="ImageButton" InsertText="Insert Order" UpdateText="Update record"
                        UniqueName="EditCommandColumn1" CancelText="Cancel edit">
    </EditColumn>
</EditFormSettings>
</MasterTableView>
   <%--DOUBLE CLICKING ON GRIDVIEW ROW ACTIVATES THE EDIT ROW MODE--%>          
    <ClientSettings>
                <ClientEvents OnRowDblClick="RowDblClick" />
    </ClientSettings>
</telerik:RadGrid>
<telerik:GridTextBoxColumnEditor ID="GridTxtboxTemp" runat="server" TextBoxStyle-Width="300px" />
<telerik:GridDropDownListColumnEditor ID="GridDropDownColumnEditor1" runat="server" DropDownStyle-Width="200px" />
 
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
    ConnectionString="<%$ ConnectionStrings:muharramConnectionString %>"
    SelectCommand="SELECT * FROM [AreaName]"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
    ConflictDetection="CompareAllValues"
    ConnectionString="<%$ ConnectionStrings:muharramConnectionString %>"
    DeleteCommand="DELETE FROM [Nauha] WHERE [nauhaID] = @original_nauhaID AND [title] = @original_title AND (([author] = @original_author) OR ([author] IS NULL AND @original_author IS NULL)) AND (([lyrics] = @original_lyrics) OR ([lyrics] IS NULL AND @original_lyrics IS NULL)) AND (([reciter] = @original_reciter) OR ([reciter] IS NULL AND @original_reciter IS NULL)) AND (([year] = @original_year) OR ([year] IS NULL AND @original_year IS NULL)) AND (([format] = @original_format) OR ([format] IS NULL AND @original_format IS NULL)) AND (([duration] = @original_duration) OR ([duration] IS NULL AND @original_duration IS NULL)) AND (([size] = @original_size) OR ([size] IS NULL AND @original_size IS NULL)) AND (([url] = @original_url) OR ([url] IS NULL AND @original_url IS NULL)) AND (([tags] = @original_tags) OR ([tags] IS NULL AND @original_tags IS NULL)) AND (([counter] = @original_counter) OR ([counter] IS NULL AND @original_counter IS NULL)) AND (([uploader] = @original_uploader) OR ([uploader] IS NULL AND @original_uploader IS NULL)) AND (([date] = @original_date) OR ([date] IS NULL AND @original_date IS NULL)) AND (([areaID] = @original_areaID) OR ([areaID] IS NULL AND @original_areaID IS NULL)) AND (([Discontinued] = @original_Discontinued) OR ([Discontinued] IS NULL AND @original_Discontinued IS NULL))"
    InsertCommand="INSERT INTO [Nauha] ([title], [author], [lyrics], [reciter], [year], [format], [duration], [size], [url], [tags], [counter], [uploader], [date], [areaID], [Discontinued]) VALUES (@title, @author, @lyrics, @reciter, @year, @format, @duration, @size, @url, @tags, @counter, @uploader, @date, @areaID, @Discontinued)"
    OldValuesParameterFormatString="original_{0}"
    SelectCommand="SELECT * FROM [Nauha] ORDER BY [areaID]"
     
    UpdateCommand="UPDATE [Nauha] SET [title] = @title, [author] = @author, [lyrics] = @lyrics, [reciter] = @reciter, [year] = @year, [format] = @format, [duration] = @duration, [size] = @size, [url] = @url, [tags] = @tags, [counter] = @counter, [uploader] = @uploader, [date] = @date, [areaID] = @areaID, [Discontinued] = @Discontinued WHERE [nauhaID] = @original_nauhaID AND [title] = @original_title AND (([author] = @original_author) OR ([author] IS NULL AND @original_author IS NULL)) AND (([lyrics] = @original_lyrics) OR ([lyrics] IS NULL AND @original_lyrics IS NULL)) AND (([reciter] = @original_reciter) OR ([reciter] IS NULL AND @original_reciter IS NULL)) AND (([year] = @original_year) OR ([year] IS NULL AND @original_year IS NULL)) AND (([format] = @original_format) OR ([format] IS NULL AND @original_format IS NULL)) AND (([duration] = @original_duration) OR ([duration] IS NULL AND @original_duration IS NULL)) AND (([size] = @original_size) OR ([size] IS NULL AND @original_size IS NULL)) AND (([url] = @original_url) OR ([url] IS NULL AND @original_url IS NULL)) AND (([tags] = @original_tags) OR ([tags] IS NULL AND @original_tags IS NULL)) AND (([counter] = @original_counter) OR ([counter] IS NULL AND @original_counter IS NULL)) AND (([uploader] = @original_uploader) OR ([uploader] IS NULL AND @original_uploader IS NULL)) AND (([date] = @original_date) OR ([date] IS NULL AND @original_date IS NULL)) AND (([areaID] = @original_areaID) OR ([areaID] IS NULL AND @original_areaID IS NULL)) AND (([Discontinued] = @original_Discontinued) OR ([Discontinued] IS NULL AND @original_Discontinued IS NULL))">
    <DeleteParameters>
        <asp:Parameter Name="original_nauhaID" Type="Int32" />
        <asp:Parameter Name="original_title" Type="String" />
        <asp:Parameter Name="original_author" Type="String" />
        <asp:Parameter Name="original_lyrics" Type="String" />
        <asp:Parameter Name="original_reciter" Type="String" />
        <asp:Parameter Name="original_year" Type="Int16" />
        <asp:Parameter Name="original_format" Type="String" />
        <asp:Parameter DbType="Time" Name="original_duration" />
        <asp:Parameter Name="original_size" Type="String" />
        <asp:Parameter Name="original_url" Type="String" />
        <asp:Parameter Name="original_tags" Type="String" />
        <asp:Parameter Name="original_counter" Type="Int32" />
        <asp:Parameter Name="original_uploader" Type="String" />
        <asp:Parameter Name="original_date" Type="DateTime" />
        <asp:Parameter Name="original_areaID" Type="Int32" />
        <asp:Parameter Name="original_Discontinued" Type="Boolean" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="title" Type="String" />
        <asp:Parameter Name="author" Type="String" />
        <asp:Parameter Name="lyrics" Type="String" />
        <asp:Parameter Name="reciter" Type="String" />
        <asp:Parameter Name="year" Type="Int16" />
        <asp:Parameter Name="format" Type="String" />
        <asp:Parameter DbType="Time" Name="duration" />
        <asp:Parameter Name="size" Type="String" />
        <asp:Parameter Name="url" Type="String" />
        <asp:Parameter Name="tags" Type="String" />
        <asp:Parameter Name="counter" Type="Int32" />
        <asp:Parameter Name="uploader" Type="String" />
        <asp:Parameter Name="date" Type="DateTime" />
        <asp:Parameter Name="areaID" Type="Int32" />
        <asp:Parameter Name="Discontinued" Type="Boolean" />
    </InsertParameters>
    <UpdateParameters>
        <asp:Parameter Name="title" Type="String" />
        <asp:Parameter Name="author" Type="String" />
        <asp:Parameter Name="lyrics" Type="String" />
        <asp:Parameter Name="reciter" Type="String" />
        <asp:Parameter Name="year" Type="Int16" />
        <asp:Parameter Name="format" Type="String" />
        <asp:Parameter DbType="Time" Name="duration" />
        <asp:Parameter Name="size" Type="String" />
        <asp:Parameter Name="url" Type="String" />
        <asp:Parameter Name="tags" Type="String" />
        <asp:Parameter Name="counter" Type="Int32" />
        <asp:Parameter Name="uploader" Type="String" />
        <asp:Parameter Name="date" Type="DateTime" />
        <asp:Parameter Name="areaID" Type="Int32" />
        <asp:Parameter Name="Discontinued" Type="Boolean" />
        <asp:Parameter Name="original_nauhaID" Type="Int32" />
        <asp:Parameter Name="original_title" Type="String" />
        <asp:Parameter Name="original_author" Type="String" />
        <asp:Parameter Name="original_lyrics" Type="String" />
        <asp:Parameter Name="original_reciter" Type="String" />
        <asp:Parameter Name="original_year" Type="Int16" />
        <asp:Parameter Name="original_format" Type="String" />
        <asp:Parameter DbType="Time" Name="original_duration" />
        <asp:Parameter Name="original_size" Type="String" />
        <asp:Parameter Name="original_url" Type="String" />
        <asp:Parameter Name="original_tags" Type="String" />
        <asp:Parameter Name="original_counter" Type="Int32" />
        <asp:Parameter Name="original_uploader" Type="String" />
        <asp:Parameter Name="original_date" Type="DateTime" />
        <asp:Parameter Name="original_areaID" Type="Int32" />
        <asp:Parameter Name="original_Discontinued" Type="Boolean" />
    </UpdateParameters>
</asp:SqlDataSource>

Code Behind

Protected Sub RadGrid1_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound
         
        If TypeOf e.Item Is GridEditableItem And e.Item.IsInEditMode Then
            Dim upload As RadUpload = e.Item.FindControl("RadUpload1")
            Dim script As String = String.Format("uploadId = '{0}';", upload.ClientID)
            ScriptManager.RegisterStartupScript(Page, Page.[GetType](), "initialize", script, True)
        End If
End Sub
 
 
 Protected Sub RadGrid1_ItemInserted(source As Object, e As Telerik.Web.UI.GridInsertedEventArgs) Handles RadGrid1.ItemInserted
        Dim item As GridEditFormInsertItem = DirectCast(e.Item, GridEditFormInsertItem)
        Dim uploader As RadUpload = TryCast(e.Item.FindControl("RadUpload1"), RadUpload)
        Dim myUploadedFile As UploadedFile = uploader.UploadedFiles(0)
        Dim fileName As String = myUploadedFile.FileName
 
        'Gets the uploaded file extension
        Dim fileExt As String
        fileExt = System.IO.Path.GetExtension(myUploadedFile.FileName).ToLower
 
        myUploadedFile.SaveAs("~/Uploads/" & fileName)
         
    End Sub
Radoslav
Telerik team
 answered on 14 Nov 2012
8 answers
2.1K+ views

Might anyone be able to suggest why I am geting this error when I host my web application in IIS?
If I use the Visual Studio Dev server, the page loads with a scheduler.
All I do is create a virtual directory for my app in IIS and I get the following error...

Any hep would be greatly appreciated. Thanks.

The remote server returned an error: (401) Unauthorized.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.WebException: The remote server returned an error: (401) Unauthorized.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[WebException: The remote server returned an error: (401) Unauthorized.]
   System.Net.WebClient.UploadDataInternal(Uri address, String method, Byte[] data, WebRequest& request) +302
   System.Net.WebClient.UploadString(Uri address, String method, String data) +170
   System.Net.WebClient.UploadString(String address, String method, String data) +35
   Telerik.Web.UI.SchedulerWebServiceClient.GetResources() +460

[Exception: An error occurred while requesting resources from the web service. Server responded with: {"Message":"Authentication failed.","StackTrace":null,"ExceptionType":"System.InvalidOperationException"}]
   Telerik.Web.UI.SchedulerWebServiceClient.GetResources() +622
   Telerik.Web.UI.RadScheduler.BindResourcesFromWebService() +95
   Telerik.Web.UI.RadScheduler.PerformSelect() +122
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
   Telerik.Web.UI.RadScheduler.EnsureDataBound() +51
   Telerik.Web.UI.RadScheduler.CreateChildControls(Boolean bindFromDataSource) +63
   Telerik.Web.UI.RadScheduler.CreateChildControls() +10
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +44
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842


        <telerik:RadScheduler    ID="RadScheduler1"   
                                            runat="server"   
                                            Height=""   
                                            HoursPanelTimeFormat="htt"   
                                            ValidationGroup="RadScheduler1"   
                                            StartEditingInAdvancedForm="false"   
                                            Skin="Office2007">  
            <WebServiceSettings Path="SchedulerWebService.asmx" ResourcePopulationMode="ServerSide" /> 
        </telerik:RadScheduler> 

Plamen
Telerik team
 answered on 14 Nov 2012
3 answers
591 views
Hi,
I have the following environment:  VS 2010, Asp.Net, Visual Basic and Telerik controls.

I started this project by trying to implement this solution with an unbound Radgrid, but then the Radgrid html code was not sent to the client in the page source file, I decided to use the bound Radgrid method.
Here is what i'm trying now:
I created an .aspx page that has an empty (no columns defined) Radgrid control bound to a datasource that I'm populating in the Onclick event code of a button using the following code:

    Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click

            SqlDataSource1.SelectCommand = "exec CreateForecastEntry 'F2012v1', 'USA-ILMO-T1' "
            grdForecast.DataBind()

    End Sub


The datasource query returns a dataset with a variable number of columns (months) depending on some user settings.  I want the user to be able to edit the grid columns, so I want to add GridTemplateColumns with Textboxes for each of the columns.

The grid should look similar to this:

the Query returns in this case 3 columns, which I want to transform into 5 columns like this:

Column names:   Item | January | February | T_January | T_February
Column types:  GridBoundColumn | GridBoundColumn | GridBoundColumn | GridTemplateColumn (textbox) | GridTemplateColumn (textbox)

Note:  The number of months will be variable.

I have tried using the following code to create the columns, but it does not create the appropriate number of columns, and it creates them at the beginning of the grid:

Protected Sub grdForecast_ItemCreated(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles grdForecast.ItemCreated
        Dim tc As New GridTemplateColumn

        tc.HeaderText = "qty_" & e.Item.UniqueID
        tc.UniqueName = "qty1_" & e.Item.UniqueID
        tc.ItemTemplate = New MyTemplate(tc.UniqueName)
        grdForecast.MasterTableView.Columns.Add(tc)

    End Sub
    Private Class MyTemplate
        Implements ITemplate
        Protected textBox As TextBox
        Private colname As String

        Public Sub New(ByVal cName As String)
            MyBase.New()
            colname = cName
        End Sub

        Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements ITemplate.InstantiateIn
            textBox = New TextBox
            textBox.ID = "abc"
            container.Controls.Add(textBox)
        End Sub
    End Class


This code will create a random number of GridTemplateColumns and I'm able to see them in the browser page source code, but I cannot access the textboxes content using this code:

    Protected Sub Button2_Click(sender As Object, e As System.EventArgs) Handles Button2.Click
        Dim quantity As TextBox
        For Each row As GridDataItem In grdForecast.Items
             quantity = CType(row.FindControl("abc"), TextBox)
            quantity = Nothing
        Next
    End Sub

Any insight on what I'm doing wrong would be appreciated. Thanks
Eduardo
Shinu
Top achievements
Rank 2
 answered on 14 Nov 2012
1 answer
49 views
<telerik:RadListView ID="rlv_telephone" runat="server" AllowPaging="true" ItemPlaceholderID="pnl_telephone" DataKeyNames="telephone_id">
 
<telerik:RadDataPager ID="rdp_account_telephone" runat="server" PagedControlID="rlv_telephone"
                                                    PageSize="2" Font-Size="10px">

    Private Sub rlv_telephone_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadListViewItemEventArgs) Handles rlv_telephone.ItemDataBound
        If TypeOf (e.Item) Is RadListViewDataItem Then
            Dim item = TryCast(e.Item, RadListViewDataItem)
            Dim datakey As DataKey = Me.rlv_telephone.DataKeyValues(item.DataItemIndex)
            TryCast(item.FindControl("btn_edittelephone"), RadButton).Attributes.Add("onclick", "openTelephone('" & datakey("telephone_id") & "')")
        End If
    End Sub  
 
Private Sub rlv_telephone_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadListViewNeedDataSourceEventArgs) Handles rlv_telephone.NeedDataSource
            GetTelephones()
    End Sub
 
    Protected Sub GetTelephones(Optional ByVal bind As Boolean = False)
        Me.rlv_telephone.DataSource = fe_telephone.functions.get_fe_telephone_list_by_account_id(this_account_id)
 
        If bind Then
            Me.rlv_telephone.DataBind()
        End If
    End Sub


When the page first loads its fine. When I change page it throws an error on Me.rlv_telephone.DataKeyValues(item.DataItemIndex) stating System.ArgumentOutOfRangeException.






Andrey
Telerik team
 answered on 14 Nov 2012
5 answers
262 views
Hi!

I have a question about setting focus on a radtextbox inside a radpanelbar. My code looks like this:
<telerik:RadPanelBar ID="RadPanelBar" runat="server" Width="100%" OnClientItemExpand="onItemExpand">
    <Items>
      <telerik:RadPanelItem Text="Zoeken" Value="Search">
        <ContentTemplate>
        <asp:Panel ID="ExamSearchPanel" runat="server" DefaultButton="SearchButton">
          <table>
            <tr>
              <td>
                <asp:Table runat="server">
                  <asp:TableRow ID="TrainingCompanyRow" runat="server">
                    <asp:TableCell>Opleider:</asp:TableCell>
                    <asp:TableCell><telerik:RadTextBox ID="TrainingCompanyTextBox" runat="server" /></asp:TableCell>
                  </asp:TableRow>

OnClientItemExpand, I want to set focus to the TrainingCompanyTextBox control with javascript. I've tried different ways of setting focus to the contorl, but i can't find the solution.

How can I do this?
Princy
Top achievements
Rank 2
 answered on 14 Nov 2012
1 answer
89 views
Hello, I'm using RadGrid and I need to remove in my footer row the follow Text "Sum, Count, Avg" and I need to show only the numbers.

How I do this?
Shinu
Top achievements
Rank 2
 answered on 14 Nov 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?