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

Hi everybody and thanks for your help! Im facing this problem: Ive a Radgrid which has a GridTemplateColumn which has a CheckBox inside. In the page load 1 row is inserted in the radgrid and displayed properly. Then, there is a RadButton (which only Works in the client side). When pressed it binds the radgrid to a new datasource with 2 rows. The problem is that the first row is displayed correctly while the second row is missing the checkbox. I did not use Eval since the radgrid must be bind in the client side (then, Ive used gridRowBound and gridRowCreated). Ive prepared an example code to show exactly this problem: you just need to créate a Web Application “WebApplicationRadGridCheckBox” and modify the Default.aspx code with the code below.

Thank you very much! Matias

Default.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplicationRadGridCheckBox._Default" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
    
</head>
<body>
    <telerik:RadScriptBlock ID="RadScriptBlockTipoDocumentoDetails" runat="server">
        <script type="text/javascript">
            function Add(sender, eventArgs) {
                var grid = $find("<%=RadGridTest.ClientID %>");
                var mt = grid.get_masterTableView();
                var items = mt.get_dataItems();
                var source = new Array();
                var item = { Field1: false, Field2: "new item 1!!!" };
                source[source.length] = item;
                var item2 = { Field1: false, Field2: "new item 2!!!" };
                source[source.length] = item2;
                mt.set_dataSource(source);
                mt.dataBind();
            }
            function gridRowBound (sender, args) {
                var checkbox = args.get_item().findElement("Field1");
                if (checkbox && checkbox != null) {
                    checkbox.checked = args.get_dataItem().Field1 == "True";
                }
            }
            function gridRowCreated (sender, args) {
                var checkbox = args.get_item().findElement("Field1");
                if (checkbox && checkbox != null) {
                    checkbox.checked = args._gridDataItem.getDataKeyValue("Field1") == "True";
                }
            }
        </script>
    </telerik:RadScriptBlock>
    <form id="form1" runat="server">
        <asp:ScriptManager runat="server" ID="ScriptManager1"/>
        <div>
            <telerik:RadButton ID="RadButton1" runat="server" Text="Add" OnClientClicked="Add" UseSubmitBehavior="false" AutoPostBack="false"/>
            <telerik:RadGrid ID="RadGridTest" runat="server" AutoGenerateColumns="false" AllowMultiRowSelection="true" Height="200px">
                <MasterTableView Caption="" ClientDataKeyNames="Field1,Field2" DataKeyNames="Field1,Field2">
                    <Columns>
                        <telerik:GridTemplateColumn>
                            <ItemTemplate>
                                <asp:CheckBox ID="Field1" runat="server"/>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn HeaderText="Field2" DataField="Field2"/>
                    </Columns>
                </MasterTableView>
                <ClientSettings EnableRowHoverStyle="true" >
                    <Selecting AllowRowSelect="true" />
                    <Scrolling AllowScroll="True" SaveScrollPosition="True"/>
                    <ClientEvents   OnRowDataBound="gridRowBound"
                                    OnRowCreated="gridRowCreated"/>
                </ClientSettings>
            </telerik:RadGrid>
        </div>
    </form>
</body>
</html>


Default.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplicationRadGridCheckBox
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            List<TestClass> lista = new List<TestClass>() { new TestClass() { Field1 = true, Field2 = "JOJO" } };
            RadGridTest.DataSource = lista;
            RadGridTest.DataBind();
        }
    }
    public class TestClass
    {
        public Boolean Field1 { get; set; }
        public String Field2 { get; set; }
    }
}

Radoslav
Telerik team
 answered on 23 Oct 2012
1 answer
237 views
hi

i have downloaded a skin called Metro Green ASPX Ajax from http://www.telerik.com/support/skins.aspx. After unzip, i copied and paste to the C:\Program Files (x86)\Telerik\RadControls for ASP.NET AJAX Q3 2012\Skins.

How come i don't see it listed in the skin property of a radgird? i can only see those usual skin like default, black, metro touch, hay and so on.

What else must i do? Thanks
Bozhidar
Telerik team
 answered on 23 Oct 2012
3 answers
105 views
hi, i have rad combobox in my web page that i defined it like this:
 <telerik:RadComboBox  DropDownWidth="220px" runat="server" ID="UnitCombo"> 
                    <HeaderTemplate>
                        <table cellpadding="0" width="200px" cellspacing="0">
                            <tr>
                                <td style=" width:100px" >unit</td>
                                <td style="width:100px">ReviseState</td>
                            </tr>
                        </table>
                    </HeaderTemplate>
                    <ItemTemplate>
                     <table cellpadding="0" width="200px" cellspacing="0">
                            <tr>
                                <td style=" width:100px" >
                                    <%# DataBinder.Eval(Container,"Text") %>
                                </td>
                                <td style="width:100px">
                                      <%# DataBinder.Eval(Container,"Attributes['State']") %>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </telerik:RadComboBox>

i want to add new items to this radcombo in clientside so i wrote this code:
      function updateCombo(result) {
            var UnitCombo = $find("<%= UnitCombo.ClientID %>");
            var Comitems = UnitCombo.get_items();
            Comitems.clear();
            var items = result.split('|');
            for (var i = 0; i < items.length; i++) {
                var temp = items[i].split(',');
                UnitCombo.trackChanges();
                var comboItem = new Telerik.Web.UI.RadComboBoxItem();
                comboItem.set_text(temp[0]);
                comboItem.get_attributes().setAttribute("State", temp[1]);

                UnitCombo.get_items().add(comboItem);
                UnitCombo.commitChanges();
            }
          
        }
items add to radcombo correctly but attribute part does not show,and no script error happen also
items in radcombo just show Unit part....
please help me..thanks
Nencho
Telerik team
 answered on 23 Oct 2012
3 answers
199 views

Hi

I have used Textbox in Web Address.
How to check Validation web address.
Below my coding and also see my screen shot.



<telerik:RadTextBox Width="95%" ID="WebAddress" AutoCompleteType="Disabled" runat="server" FocusedStyle-BackColor="Lavender"
                                                            Text='<%# Bind("webaddress") %>' MaxLength="50" onkeydown = "return (event.keyCode!=13);" CssClass="Lowercase1">
                                                        </telerik:RadTextBox>

<telerik:RadInputManager ID="RadInputManager1" runat="server" EnableEmbeddedSkins="false">
<telerik:RegExpTextBoxSetting ValidationExpression="^\w+([-+.']\w+)*\.\w+([-.]\w+)*$"
                                                            ErrorMessage="Web Address">
                                                            <TargetControls>
                                                                <telerik:TargetInput ControlID="WebAddress" />
                                                            </TargetControls>
                                                        </telerik:RegExpTextBoxSetting>
</telerik:RadInputManager>


Thanks
Ansari
Kostadin
Telerik team
 answered on 23 Oct 2012
6 answers
254 views
I tried this:

if (e.Column.UniqueName.Contains("SomeColumn"))

{

GridBoundColumn item = (GridBoundColumn)e.Column;

item.Aggregate =

GridAggregateFunction.Avg;

}

@ column created step.

did not work.
Thanks in advance.

Radoslav
Telerik team
 answered on 23 Oct 2012
6 answers
207 views
I have used telerik rad grid client-side programmatic binding. Binding is working fine but the nested view template expand image button is not displaying with more than 10 records. I am adding user control dynamically to that nested view template.

  
<telerik:RadGrid ID="rgInvoiceDetails" runat="server" GridLines="None" AllowSorting="false" AutoGenerateColumns="False" CellSpacing="0">
  <ClientSettings>
 <ClientEvents OnCommand="rgInvoiceDetails_Command" OnHierarchyExpanding="rgInvoiceDetails_HierarchyExpanding"
       OnRowDataBound="rgInvoiceDetails_RowDataBound" />
  </ClientSettings>
   <MasterTableView ClientDataKeyNames="FeeChassisInvoiceDetailID,Disputed" CommandItemDisplay="Top"
     Width="100%" HierarchyLoadMode="Client">
 <Columns>
  <telerik:GridBoundColumn DataField="ChassisNumber" HeaderText="Chassis" />
 <telerik:GridBoundColumn DataField="BillFromDate" HeaderText="Out Gate" DataFormatString="{0:d}" />
 <telerik:GridBoundColumn DataField="BillToDate" HeaderText="In Gate" DataFormatString="{0:d}" />
 <telerik:GridBoundColumn DataField="BillDays" HeaderText="Days" />
  <telerik:GridBoundColumn DataField="Rate" HeaderText="Rate" DataType="System.Decimal"
  DataFormatString="{0:c}" />
 <telerik:GridBoundColumn DataField="FeeAmount" HeaderText="Total" DataType="System.Decimal"
 DataFormatString="{0:c}" />
  <telerik:GridBoundColumn DataField="Disputed" HeaderText="" ItemStyle-CssClass="MyCustomHeaderClass" />
 </Columns>
 <NestedViewTemplate>
 </NestedViewTemplate>
<HeaderStyle CssClass="MyCustomHeaderClass" />
 </MasterTableView>
 </telerik:RadGrid>

Thanks in advance.
Jayesh Goyani
Top achievements
Rank 2
 answered on 23 Oct 2012
3 answers
144 views
Hello,

http://demos.telerik.com/aspnet-ajax/grid/examples/overview/defaultcs.aspx

Please check attached image : Untitled.

Sorry by mistake i have added Untitled1 image.

Thanks,
Jayesh Goyani
Jayesh Goyani
Top achievements
Rank 2
 answered on 23 Oct 2012
0 answers
82 views
Is there any way to display read-only fields using the GridHTMLEditorColumn?

I've been trying to use a GridHTMLEditor column and it looks to me like the only way I can get a field to show up is to make it editable. 

(Everything I've seen so far makes me think a FormsTemplate would be a far better choice.)

Let's forget this one for now.  I seem to have been asking the wrong questions.
Boris
Top achievements
Rank 1
 asked on 22 Oct 2012
0 answers
46 views
This examples takes the name of the tab from the name of the .ascx file. I want to have my own tab name,which may include spaces as well.
Imports System
Imports Telerik.Web.UI
 
 
Namespace Telerik.Web.Examples.TabStrip.ApplicationScenarios.LoadOnDemand
 
    Partial Public Class DefaultVB
        Inherits System.Web.UI.Page
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not Page.IsPostBack Then
                AddTab("Customers")
                AddPageView(RadTabStrip1.FindTabByText("Customers"))
                AddTab("Products")
                AddTab("Orders")
            End If
        End Sub
 
        Private Sub AddTab(ByVal tabName As String)
            Dim tab As RadTab = New RadTab
            tab.Text = tabName
            RadTabStrip1.Tabs.Add(tab)
        End Sub
 
        Protected Sub RadMultiPage1_PageViewCreated(ByVal sender As Object, ByVal e As RadMultiPageEventArgs) Handles RadMultiPage1.PageViewCreated
            Dim userControlName As String = e.PageView.ID & "VB.ascx"
            Dim userControl As Control = Page.LoadControl(userControlName)
            userControl.ID = e.PageView.ID & "_userControl"
            e.PageView.Controls.Add(userControl)
        End Sub
 
        Private Sub AddPageView(ByVal tab As RadTab)
            Dim pageView As RadPageView = New RadPageView
            pageView.ID = tab.Text
            RadMultiPage1.PageViews.Add(pageView)
            pageView.CssClass = "pageView"
            tab.PageViewID = pageView.ID
        End Sub
 
        Protected Sub RadTabStrip1_TabClick(ByVal sender As Object, ByVal e As RadTabStripEventArgs) Handles RadTabStrip1.TabClick
            AddPageView(e.Tab)
            e.Tab.PageView.Selected = True
        End Sub
 
    End Class
 
End Namespace
Aamir
Top achievements
Rank 1
 asked on 22 Oct 2012
2 answers
217 views
Hi,

I have a radcombobox with checkboxes and am using multiselect.  I am using the server side on click event which of course is causing a postback.  With this in mind is it possible to maintain the scroll position in the rad combo box. 
For example,  if I check the 54th item in the list it then returns me back to the top of the list.  I would like it to return to the item that I checked.

Thank you for your help.
Tracy
Tracy
Top achievements
Rank 1
 answered on 22 Oct 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?