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

I'm trying to access GridBoundColumns data. It is returning ' ' when that cell is blank. Is something wrong in the code?

Thanks
Neelima

Private Sub RadgridDestination_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadgridDestination.SelectedIndexChanged
  
        Dim row As GridDataItem = RadgridDestination.Items(RadgridDestination.SelectedIndexes(0))
  
With uc_Addr 'uc_Addr is a UserControl
 .Addr2  = row("Address2").Text     ' here .Addr2 =    when Address2 columnis blank 
End With
End Sub
  <telerik:RadGrid ID="RadgridDestination" runat="server" 
     AllowSorting="True"  ShowGroupPanel="True" 
     AutoGenerateColumns="False"
          Skin="Sunset" AllowPaging="True" GridLines="None">
  
        <GroupingSettings ShowUnGroupButton="True"  />
        <ClientSettings AllowDragToGroup="True" allowcolumnsreorder="True" 
            columnsreordermethod="Reorder" reordercolumnsonclient="True" >
        </ClientSettings>
          
  
<MasterTableView EditMode="InPlace" DataKeyNames="Destination_ID" GroupLoadMode="Client" >
<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
  
    <Columns>
<telerik:GridBoundColumn DataField="Addr2" HeaderText="Address2" UniqueName="Address2" ReadOnly="true"></telerik:GridBoundColumn>
'
'
'
'
'
</Columns>
           <EditFormSettings>
<EditColumn UniqueName="EditCommandColumn1"></EditColumn>
</EditFormSettings>
</MasterTableView>
  
  
    </telerik:RadGrid>
Princy
Top achievements
Rank 2
 answered on 25 Oct 2010
5 answers
133 views

hi,

I have created a dynamic tab function. When i click button1 it will create dynamic tab and pageview for that tab. But when i deleted that tab that pageview is not deleting. Can any one help me to fix this

HERE IS MY SAMPLE CODE

using System; 
using System.Data; 
using System.Configuration; 
using System.Collections; 
using System.Web; 
using System.Web.Security; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.Web.UI.WebControls.WebParts; 
using System.Web.UI.HtmlControls; 
using Telerik.WebControls; 
using Telerik; 
 
public partial class Radstrip2 : System.Web.UI.Page 
    protected System.Web.UI.WebControls.Label PageContent; 
    protected System.Web.UI.WebControls.Repeater BuildingSummary; 
    protected Telerik.WebControls.PageView PageView1; 
 
    protected void Page_Load(object sender, EventArgs e) 
    { 
        if (!Page.IsPostBack) 
        { 
            Tab tab = new Tab(); 
            tab.Text = string.Format("New Page {0}", 1); 
            RadTabStrip1.Tabs.Add(tab); 
 
            PageView pageView = new PageView(); 
            RadMultiPage1.PageViews.Add(pageView); 
 
            BuildPageViewContents(pageView, RadTabStrip1.Tabs.Count); 
            RadTabStrip1.SelectedIndex = 0
 
        } 
    } 
 
    private void BuildPageViewContents(PageView pageView, int index) 
    { 
        pageView.ID = "Page " + index.ToString(); 
        pageView.Controls.Add(new LiteralControl(" <B>New page</B>" + (index).ToString())); 
    } 
 
    protected void Button1_Click(object sender, EventArgs e) 
    { 
 
        Tab tab = new Tab(); 
        tab.Text = string.Format("New Page {0}", RadTabStrip1.Tabs.Count + 1); 
        RadTabStrip1.Tabs.Add(tab); 
 
        PageView pageView = new PageView(); 
        pageView.ID = "Page " + pageView.Index.ToString(); 
        RadMultiPage1.PageViews.Add(pageView); 
 
        BuildPageViewContents(pageView, RadTabStrip1.Tabs.Count); 
        RadTabStrip1RadTabStrip1.SelectedIndex = RadTabStrip1.SelectedIndex + 1; 
        RadMultiPage1.SelectedIndex = RadTabStrip1.SelectedIndex; 
 
    } 
 
    protected void Button2_Click(object sender, EventArgs e) 
    { 
        Tab currentTab = RadTabStrip1.InnerMostSelectedTab; 
 
        if (currentTab != null) 
        { 
            ITabContainer owner = currentTab.Owner; 
            owner.Tabs.Remove(currentTab); 
            //RadMultiPage1.PageViews.Remove(currentTab.PageView); 
            if (owner.Tabs.Count > 0) 
            { 
                owner.SelectedIndex = 0
            } 
        } 
    } 
 
    protected void RadMultiPage1_PageViewItemCreated1(PageView view, int viewIndex) 
    { 
        BuildPageViewContents(view, viewIndex + 1); 
    } 
 
CWT
Top achievements
Rank 1
 answered on 25 Oct 2010
1 answer
292 views
I have a very simple Grid with a template field containing a radio button:

<telerik:RadGrid ID="rg_VehicleImages" runat="server" 
                  AllowAutomaticDeletes="True" AutoGenerateDeleteColumn="True" CssClass="radgrid" 
                  DataSourceID="sds_ImagesVehicle" GridLines="None" Width="220px">
                  <mastertableview autogeneratecolumns="False" datakeynames="IDImages" 
                  datasourceid="sds_ImagesVehicle">
                      <rowindicatorcolumn>
                          <HeaderStyle Width="20px" />
                      </rowindicatorcolumn>
                      <expandcollapsecolumn>
                          <HeaderStyle Width="20px" />
                      </expandcollapsecolumn>
                      <Columns>
                          <telerik:GridBoundColumn DataField="IDimages" DefaultInsertValue="" 
                              HeaderText="" ItemStyle-ForeColor="White" ItemStyle-Width="2px" 
                              SortExpression="True" Visible="True">
                              <HeaderStyle Width="2px" />
                              <ItemStyle ForeColor="White" Width="2px" />
                          </telerik:GridBoundColumn>
                          <telerik:GridImageColumn AlternateText="Thumbnail" 
                              DataImageUrlFields="FilePath, ThumbnailName" DataImageUrlFormatString="{0}/{1}" 
                              DataType="System.String" FooterText="ImageColumn footer" HeaderText="" 
                              ImageAlign="Middle" UniqueName="vehicleimage">
                              <HeaderStyle Width="75px" />
                          </telerik:GridImageColumn>
                          <telerik:GridBoundColumn DataField="ThumbnailName" DefaultInsertValue="" 
                              HeaderText="ThumbnailName" SortExpression="ThumbnailName" 
                              UniqueName="ThumbnailName" Visible="False">
                          </telerik:GridBoundColumn>
                          <telerik:GridTemplateColumn DefaultInsertValue="" UniqueName="rbt_VehicleImage">
                              <ItemTemplate>
                                  <asp:RadioButton ID="rbt_VehicleImage" GroupName="MyGroup"
                                  onclick="MyClick(this,event)" runat="server" />
                              </ItemTemplate>
                          </telerik:GridTemplateColumn>
                      </Columns>
                  </mastertableview>
                  <clientsettings>
                      <clientevents onrowdblclick="RowClick" />
                  </clientsettings>
              </telerik:RadGrid>

The grid displays images of a vehicle selected from a database on the key field IDVehicle where tbl_Images.IDVehicle = tbl_Vehicles.IDVehicle

There may be many images for the vehicle so I need to be able to allow the user to select one image as the 'default' or main image to use on reports. To do this I thought it would be simple to add a radio button to the grid so that when the user selectes the radio button the database would be updated so that the DefaultImage field (SQLDataType = BIT) would be set to True for the selected radio button and all of the other buttons with the same IDVehicle would be set to False. Something like:

Protected Sub rg_VehicleImages_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rg_VehicleImages.ItemDataBound
    If TypeOf e.Item Is GridDataItem Then
        Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
        Dim RadioBtn As RadioButton = DirectCast(item.FindControl("rbt_VehicleImage"), RadioButton)
        If RadioBtn.Checked = False Then
            Dim sql As String
            Dim strConnString As [String] = System.Configuration.ConfigurationManager.ConnectionStrings("CF_SQL_Connection").ConnectionString()
            sql = "UPDATE CF_Images SET DefaultImage = @Value WHERE IDImages = @IDImages"
            Dim connection As New SqlConnection(strConnString)
            Dim command As New SqlCommand(sql, connection)
            Dim IDImages As Int32 = DirectCast(item.GetDataKeyValue("IDImages"), Int32)
            command.Parameters.Add("@IDImages", SqlDbType.Int).Value = IDImages
            command.Parameters.Add("@Value", SqlDbType.Int).Value = "0"
            command.Connection.Open()
            command.ExecuteNonQuery()
            command.Connection.Close()
        Else
            Dim sql As String
            Dim strConnString As [String] = System.Configuration.ConfigurationManager.ConnectionStrings("CF_SQL_Connection").ConnectionString()
            sql = "UPDATE CF_Images SET DefaultImage = @Value WHERE IDVehicles = @IDVehicles AND IDImages = @IDImages"
            Dim connection As New SqlConnection(strConnString)
            Dim command As New SqlCommand(sql, connection)
            Dim IDImages As Int32 = DirectCast(item.GetDataKeyValue("IDImages"), Int32)
            Dim IDVehicles As String = Request.QueryString("IDVehicles")
            command.Parameters.Add("@IDVehicles", SqlDbType.Int).Value = IDVehicles
            command.Parameters.Add("@IDImages", SqlDbType.Int).Value = IDImages
            command.Parameters.Add("@Value", SqlDbType.Int).Value = "1"
            command.Connection.Open()
            command.ExecuteNonQuery()
            command.Connection.Close()
        End If
    End If
End Sub

Of course this does not work. I am not sure if it is because I am attempting this using the Grid ItemDataBound argument and not one associated with the radio button.

Any help much appreciated.


Allan
Top achievements
Rank 2
 answered on 25 Oct 2010
1 answer
42 views
Hello,

I have a code to set content of the editor when it get blur.

function OnClientLoad(editor, args) {
            var element = document.all ? editor.get_document().body : editor.get_document();
            $telerik.addExternalHandler(element, "blur", function(e) {
                if (editor.get_text() == "") {
                    editor.set_html("content");
                }     
           });
        }

but It set the focus back to editor.

I want to set the editor content without set it's focus.


Thanks,
Mohamed Ramadan
Rumen
Telerik team
 answered on 24 Oct 2010
0 answers
59 views
rtl
when I use radcombobox with rtl property, the values appears first left to right side and then the control has refresh and values appears as expected
efrat
Top achievements
Rank 1
 asked on 24 Oct 2010
4 answers
112 views
Hi Telerik,

I have a radgrid. When i double click a particular row i get the grid in edit mode.(which i have done using javascript). I am using inplace editmode. I want to update the grid and save  the values of the row to the database on button click event. I am using an asp button which is placed outside the grid.  I am able to change the value in each cell, but i am not able to read the changed values. I don't have any unique columns. So i have not set datakeyname property.  I am using grid template columns in which i have different controls for each column(dropdownlist,checkbox,textbox). Please help me in this regard. Reply me asap.

Thanks in advance,
Priya
Priya
Top achievements
Rank 1
 answered on 24 Oct 2010
1 answer
136 views
HI

I'm adding a RadTreeView dynamically, then adding some nodes using LoadXmlString.

The Treeview is not visible after loading. But checking the source code, its there in the page, with nodes correctly added, just invisible.

What am I doing wrong?

Here is the creation code
// adding placeholder first recommdended by Telerik
PlaceHolder TVPanel = new PlaceHolder();
this.Form.Controls.Add(TVPanel);
// create a new radtreeview object

        RadTreeView Rad1 = new RadTreeView();
        Rad1.ID = "Rad1";
        Rad1.Visible = true;
        TVPanel.Controls.Add(Rad1);
// create a new radtreeview object
RadTreeView Rad1 = new RadTreeView();
Rad1.ID = "Rad1";
Rad1.Visible = true; // doesnt make a difference
TVPanel.Controls.Add(Rad1);

String TreeViewNodes = Navigator_GetContent;
Rad1.LoadXmlString(TreeViewNodes);
PlaceHolder TVPanel = new PlaceHolder();
        this.Form.Controls.Add(TVPanel);

        // create a new radtreeview object

        RadTreeView Rad1 = new RadTreeView();
        Rad1.ID = "Rad1";
        Rad1.Visible = true;
        TVPanel.Controls.Add(Rad1);
        

        // then generate the treeview content
        String TreeViewNodes = Navigator_GetContent("Navigate_GetPlaceChecklist.xquery", "");
        // attach it
        Rad1.LoadXmlString(TreeViewNodes);
PlaceHolder TVPanel = new PlaceHolder();
 
        // adding placeholder first recommdended by Telerik
        PlaceHolder TVPanel = new PlaceHolder();
        this.Form.Controls.Add(TVPanel);

        // create a new radtreeview object

        RadTreeView Rad1 = new RadTreeView();
        Rad1.ID = "Rad1";
        Rad1.Visible = true;
        TVPanel.Controls.Add(Rad1);
        

        // then generate the treeview content
        String TreeViewNodes = Navigator_GetContent("Navigate_GetPlaceChecklist.xquery", "");
        // attach it
        Rad1.LoadXmlString(TreeViewNodes);
     this.Form.Controls.Add(TVPanel);

        // create a new radtreeview object

        RadTreeView Rad1 = new RadTreeView();
        Rad1.ID = "Rad1";
        Rad1.Visible = true;
        TVPanel.Controls.Add(Rad1);
        

        // then generate the treeview content
        String TreeViewNodes = Navigator_GetContent("Navigate_GetPlaceChecklist.xquery", "");
        // attach it
        Rad1.LoadXmlString(TreeViewNodes);
// Where String Navigator_GetContent is valid Tree Node text
chrispo
Top achievements
Rank 1
 answered on 24 Oct 2010
6 answers
210 views
Hi, I try to use RadXMLHttpPanel to load image for each radgrid row during OnRowSelected client event

<ClientEvents OnRowSelected="RowSelected" />. I got this error:
XMLHttpPanel Callback Loading Error:
Exception=The target 'contentControl$RadXmlHttpPanel1' for callback could not be found or did not implement ICallBackEventHandler (screenshot attached). I am following your TELERIK.SALESDASHBOARD demo with some modifications. Below are the source codes that cause this error

.aspx codes:

 

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="BatchDetails.ascx.vb" Inherits="Controls_DocumentInquiry_BatchDetails" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">

 

      <script type="text/javascript">

            function RowSelected(sender, eventArgs)

            {

                  var orderID = sender.get_masterTableView().get_dataItems()[eventArgs.get_itemIndexHierarchical()].getDataKeyValue("BatchNumber");

                  alert(orderID);

                  var oXmlPanel = $find("<%= RadXmlHttpPanel1.ClientID %>");

                  oXmlPanel.set_value(orderID);

            }

           

      </script>

 

</telerik:RadScriptBlock>

 

<div class="batchesContainer">

      <asp:Label runat="server" ID="batchdetailsTitle" CssClass="detailsTitle">Orders for</asp:Label>

      <div class="pageNav">

            <asp:LinkButton runat="server" ID="prevPage" CssClass="prevPage">Previous</asp:LinkButton>

            <asp:LinkButton runat="server" ID="nextPage" CssClass="nextPage">Next</asp:LinkButton>

      </div>

     

   

    <div class="batchDetails">

        <div class="batchdetailsGrid">

            <telerik:RadGrid AllowFilteringByColumn="true" AllowSorting="true" ShowGroupPanel="false" Height="300px" BackColor="#393939"

            ID="rgBatchDetails" runat="server" AllowPaging="true" PageSize="10" Width="480px"

            OnPreRender="rgBatchDetails_PreRender" OnNeedDataSource="rgBatchDetails_NeedDataSource" OnSelectedIndexChanged="rgBatchDetails_SelectedIndexChanged" >

                <ClientSettings AllowDragToGroup="true" EnableRowHoverStyle="true">

                        <Selecting AllowRowSelect="true" />

                        <ClientEvents OnRowSelected="RowSelected" />

                  </ClientSettings>

                <MasterTableView AutoGenerateColumns="false" PagerStyle-Mode="NextPrevAndNumeric" ClientDataKeyNames="BatchNumber,ImageFile"         

                        TableLayout="Fixed">

                    <Columns>

                        <telerik:GridBoundColumn DataField="BatchNumber" HeaderText="Batch Number" AutoPostBackOnFilter="true" ShowFilterIcon="false" HeaderStyle-Width="60px"  FilterControlWidth="35px">

                              </telerik:GridBoundColumn>

                              <telerik:GridNumericColumn DataField="ImageFile" HeaderText="Image File" AutoPostBackOnFilter="true" ShowFilterIcon="false" HeaderStyle-Width="60px"  FilterControlWidth="35px">

                              </telerik:GridNumericColumn>

                              <telerik:GridBoundColumn DataField="MICRValue" HeaderText="MICR/OCR" HeaderStyle-Width="300px" FilterControlWidth="260px">

                              </telerik:GridBoundColumn>         

                              <telerik:GridBoundColumn DataField="Amount" HeaderText="Amount" FilterControlWidth="70px">

                              </telerik:GridBoundColumn>

                          </Columns>

 

                </MasterTableView>

            </telerik:RadGrid>

        </div>

        <div class="batchdetailsImage">

            <telerik:RadXmlHttpPanel ID="RadXmlHttpPanel1" runat="server" OnServiceRequest="RadXmlHttpPanel1_ServiceRequest" RenderMode="Block">

                    <asp:Image ID="imgDocumentImage" runat="server" Height="300px" Width="500px"/>

              </telerik:RadXmlHttpPanel>

        </div>

    </div>

    <telerik:RadAjaxLoadingPanel ID="BatchesLoadingPanel" runat="server"></telerik:RadAjaxLoadingPanel>

</div>


.vb codes:
When I click a TreeNode (LoadOnDemand: TreeNodeExpandMode.ServerSideCallBack)  on the main aspx page, it would load this control.

Imports

 

Telerik.Web.UI

 

Imports

 

System

 

Imports

 

System.Linq

 

Imports

 

System.Linq.Expressions

 

Imports

 

System.Web.UI

 

Imports

 

System.Data

 

Partial

 

Class Controls_DocumentInquiry_BatchDetails

 

 

Inherits ContentControl

 


    Protected Sub RadXmlHttpPanel1_ServiceRequest(ByVal source As Object, ByVal e As RadXmlHttpPanelEventArgs) Handles RadXmlHttpPanel1.ServiceRequest

        Dim BatchNumber = e.Value.ToString

        imgDocumentImage.ImageUrl = "Image.aspx?ImageLocation=00000481.TIF"

    End Sub

 

Protected

 

Sub Page_PreRender(ByVal sender As Object, ByVal e As EventArgs)

 

 

Dim ajaxManager As RadAjaxManager = RadAjaxManager.GetCurrent(Page)

 

ajaxManager.AjaxSettings.AddAjaxSetting(rgBatchDetails, rgBatchDetails, BatchesLoadingPanel)

 

End Sub

 


 

Protected Sub rgBatchDetails_PreRender(ByVal sender As Object, ByVal e As EventArgs)

 

 

If rgBatchDetails.MasterTableView.Items.Count > 0 And rgBatchDetails.SelectedItems.Count = 0 Then

 

rgBatchDetails.MasterTableView.Items(0).Selected =

True

 

 

End If

 

 

End Sub

 

 

Protected Sub rgBatchDetails_NeedDataSource(ByVal source As Object, ByVal e As GridNeedDataSourceEventArgs)

 

 

If Session("dsBatchData") Is Nothing Then

 

 

Else

 

rgBatchDetails.DataSource = Session(

"dsBatchData")

 

 

End If

 

 

End Sub

 


Thank you
Quan

Francis Frank
Top achievements
Rank 1
 answered on 23 Oct 2010
2 answers
501 views
Hi!

If I want to change the selected item on a RadComboBox at onload (on the client), how can I do that? The real problem is I think is finding a suitable event to call $find in. If I call $find in document.onload it just restuns null.

I have been looking for something similar to the ClientEvents on the RadTextBox but I can't find any thing like it for the RadComboBox.

Om
Top achievements
Rank 1
 answered on 23 Oct 2010
1 answer
55 views
I really want the ability via a markup property to change the text of "Paragraph Style" and "Apply Css Class".  Since most of my content users (sitefinity) are not technical, the terminology for those mean nothing, and if you look at the attached image, the text is cut off anyway (in Firefox at least)

Any change this can be put into PITS? :)

Steve
Rumen Jekov
Top achievements
Rank 1
 answered on 23 Oct 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?