Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
128 views
Hi i am using the RadGrid inside a panelbar. the panelbar is in a content template..  I have created an hidden asp itemtemplate column in the rad grid. As per my code i need to assign a value to the hidden column using a javascript. When i give document.getElementById("hdn") i always get a response of null. I even tried giving the masterpage id using ct100_hdn nothing works.

How will i access the hidden field using the javacscript?

If ur in need of the code. let me knw i shall post it..
Pavlina
Telerik team
 answered on 15 May 2009
1 answer
75 views
Hello,

I had my RadGrid with DataSourceID - from Database. The data displays fine.
 My original goal is delete the recod on the server and I noticed the sample from Help.

<telerik:RadGrid id="RadGrid1" runat="server" OnDeleteCommand="RadGrid1_DeleteCommand"
OnNeedDataSource="RadGrid1_NeedDataSource">
<MasterTableView AutoGenerateColumns="False" DataKeyNames="CustomerID">
   
<Columns>
  ........
When I tried to use that, the application never fires OnNeedDataSource event, 
so my Grid is always empty .

Did I missed something or this code sample is not complete.

Please help
Pavlina
Telerik team
 answered on 15 May 2009
1 answer
43 views
I have a telerik grid that I recently enabled pagging on.  For some Reason the images that allow the user to move through the pages are missing.  

I have a screen capture to show the image and where the buttons are missing http://cid-d277c11ef8b7f500.skydrive.live.com/self.aspx/Public/RadGrid.JPG

firstpageimageurl = mvwres://Telerik.Web.UI, Version=2008.1.619.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4/Telerik.Web.UI.Skins.Web20.Grid.PagingFirst.gif




 

<telerik:RadGrid ID="grdAllGraphics" runat="server" AutoGenerateColumns="False"

 

 

GridLines="None" Skin="Web20" Width="300px" AllowMultiRowSelection="True"

 

 

AllowCustomPaging="True" AllowPaging="True" PageSize="2" ShowFooter="True"

 

 

ShowGroupPanel="True" ShowStatusBar="True">

 

 

<PagerStyle AlwaysVisible="True" NextPageToolTip="Where is this" BorderStyle="Solid" PageButtonCount="2" />

 

 

<MasterTableView>

 

 

<RowIndicatorColumn>

 

 

<HeaderStyle Width="20px" />

 

 

</RowIndicatorColumn>

 

 

<ExpandCollapseColumn>

 

 

<HeaderStyle Width="20px" />

 

 

</ExpandCollapseColumn>

 

 

<Columns>

 

 

 

 

 

 

<telerik:GridTemplateColumn

 

 

UniqueName="CheckBoxTemplateColumn">

 

 

<ItemTemplate>

 

 

<asp:CheckBox

 

 

ID="CheckBox1" runat="server"

 

 

OnCheckedChanged="ToggleRowSelection"

 

 

AutoPostBack="True"

 

 

/>

 

 

</ItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

 

 

 

 

<telerik:GridBoundColumn DataField="PartNo" HeaderText="Part #"

 

 

UniqueName="column">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="Description" HeaderText="Description"

 

 

UniqueName="column1">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridTemplateColumn HeaderText="Graphic" UniqueName="TemplateColumn">

 

 

<ItemTemplate>

 

 

<asp:HyperLink ID="HyperLink1" Target="_blank" NavigateUrl ='<%# Eval("ImagePath") %>' runat="server"> <img ALT='' src='<%# Eval("ImagePath") %>' width='75'/> </asp:HyperLink>

 

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridBoundColumn DataField="GraphicInventoryID" UniqueName="GraphicInventoryID" >

 

 

</telerik:GridBoundColumn>

 

 

</Columns>

 

 

 

 

 

</MasterTableView>

 

 

<ClientSettings AllowRowsDragDrop="False">

 

 

<Selecting AllowRowSelect="True" />

 

 

</ClientSettings>

 

 

</telerik:RadGrid>

 

Pavlina
Telerik team
 answered on 15 May 2009
1 answer
313 views
Hi,

I'm using a RadGrid in Card View as shown in your demo's Grid CardView Demo.  This works great and gives a nice look to my application.  But I'm struggling to return the clicked row's data key.  My normal approach would be to expose the unique cells innerhtml but with the itemtemplate I'm getting the full cardview html.

<telerik:RadGrid ID="InstancesGrid" runat="server"  GridLines="Horizontal" 
    OnNeedDataSource="InstancesGrid_OnNeedDataSource" Height="50%">  
    <MasterTableView AutoGenerateColumns="False" CellSpacing="-1" DataKeyNames="instance_id">  
        <RowIndicatorColumn> 
            <HeaderStyle Width="20px" /> 
        </RowIndicatorColumn> 
        <ExpandCollapseColumn> 
            <HeaderStyle Width="20px" /> 
        </ExpandCollapseColumn> 
        <Columns> 
            <telerik:GridBoundColumn DataField="application_id" DataType="System.Int32"   
                HeaderText="application_id" SortExpression="application_id"   
                UniqueName="application_id" Visible="false">  
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="instance_id" DataType="System.Int32"   
                HeaderText="Instance ID" ReadOnly="True" SortExpression="instance_id"   
                UniqueName="instance_id" Visible="true">  
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="instance_name" HeaderText="Instance Name"   
                SortExpression="instance_name" UniqueName="instance_name">  
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="testing_environment_id"   
                DataType="System.Int32" HeaderText="Testing Environment"   
                SortExpression="testing_environment_id" UniqueName="testing_environment_id">  
            </telerik:GridBoundColumn> 
        </Columns> 
        <ItemTemplate> 
            <asp:Image ID="IconImage" runat="server" style="float: left;" width="50px" Height="54px" ImageUrl="Images/InstancesGrid/icon.gif" /> 
            <table> 
                <tr> 
                    <td><span>Name:</span></td>  
                    <td><%#Eval("instance_name")%></td>  
                </tr> 
                <tr> 
                    <td><span>Testing Environment:</span></td>  
                    <td><%#Eval("testing_environment_id")%></td>  
                </tr> 
            </table> 
        </ItemTemplate> 
    </MasterTableView> 
    <ClientSettings Selecting-AllowRowSelect="true" EnableRowHoverStyle="true" ClientEvents-OnRowClick="InstancesGrid_OnRowClick" /> 
</telerik:RadGrid> 
 

        function InstancesGrid_OnRowClick(sender, args) {  
 
            var index = args.get_itemIndexHierarchical();  
            var MasterTable = sender.get_masterTableView();  
            MasterTable.selectItem(MasterTable.get_dataItems()[index].get_element(), true);  
 
            var selectedRows = MasterTable.get_selectedItems();  
 
            var row = selectedRows[0];  
            alert(row);  
            var cell = MasterTable.getCellByColumnUniqueName(row, "instance_id");  
            alert(cell);  
            var instance_id = cell.innerHTML;  
            alert(instance_id);  
 
        } 

The alert(instance_id) returns the full itemtemplate html :-

<IMG id=InstancesGrid_ctl--_ctl06_iconImage ....>

All I want is the data key (instance_id) for the record in the selected row.

Thanks
Jase



Nikolay Rusev
Telerik team
 answered on 15 May 2009
1 answer
139 views
Hi,

     I want to create Hierarchy Grid  in server side.

     Actually,You provided examples for client side.

     Can you please suggest me solution for this.

Thanks,
PANDU
Shinu
Top achievements
Rank 2
 answered on 15 May 2009
1 answer
146 views
Hi,

I want to increase and decrease the size of columns of RadGrid.

Moreover i need while "Add a new record" and "edit" button is pressed, i see textboxes width is very large and i want to decrease the size.
Thanks.

Regards
Arshad
Princy
Top achievements
Rank 2
 answered on 15 May 2009
2 answers
155 views
hello to all expert

                Good Day! i would like to ask some help here coz i wasn't able to configure this out..here's my scenario when the user select on the grid, the selected row only be export to excel but i try to follow the other advice using the radgrid.rebind() but the problem is it  show s all the record, but i want only the selected row will be exported to excel..anyway here is my code
 protected void RadMenu1_ItemClick(object sender, RadMenuEventArgs e) 
        { 
           
 
                switch (e.Item.Value)//parentroot 
                { 
                    case "2"://Excel 
                        RadMenuItem Excel = e.Item; 
                         
                        foreach (GridDataItem item in RdGridMainpage.Items) 
                        { 
                           
                            if (item.Selected == false) 
                            { 
 
                                item.Visible = false;     
                                
                            } 
                             
                            
 
                        } 
                        RdGridMainpage.Rebind(); 
                        RdGridMainpage.ExportSettings.ExportOnlyData = true
                        RdGridMainpage.ExportSettings.IgnorePaging = true
                        RdGridMainpage.ExportSettings.OpenInNewWindow = true
                        RdGridMainpage.ExportSettings.FileName = "Request Data"
                        RdGridMainpage.MasterTableView.ExportToExcel();   
                        break; 
===================================================== 
and my need_Datasource 
 
 protected void RdGridMainpage_NeedDataSource(object source, GridNeedDataSourceEventArgs e) 
        { 
            AppGlobalDeclarations gConn = new AppGlobalDeclarations(); 
            DataSet ds; 
           
            ds = SqlHelper.ExecuteDataset(gConn.SQLConnection, CommandType.StoredProcedure, "spu_Chs_tblRequestTicket_Mainpage_SelectExport1"); 
                                         
            try 
            { 
                 
                this.RdGridMainpage.DataSource = ds
                this.RdGridMainpage.Columns[3].Visible = false
                this.RdGridMainpage.Columns[4].Visible = true
            } 
            catch (Exception ex) 
            { throw ex; } 
        } 
 
 what should i do please help..

sample codes is highly appreciated

thanks to all
Jols
Top achievements
Rank 2
 answered on 15 May 2009
4 answers
147 views
Hi,

Below is my grid. The pager displays next and prev button in one line and 'Displaying page 1 of 4, items 1 to 5 of 19.' in second line.
I would like to display all this in a single line as seen in demos and samples.

<telerik:RadGrid ID="userGrid" runat="server" GridLines="None" AutoGenerateColumns="False"
            DataSourceID="odsUsers" OnItemDataBound="userGrid_ItemDataBound" OnPreRender="userGrid_PreRender"
            Skin="None" EnableEmbeddedSkins="false" CssClass="RadGrid" 
            AllowPaging="True" PageSize="5" Width="100%" Height="100%" PagerStyle-AlwaysVisible="true">

<MasterTableView DataKeyNames="UserId" DataSourceID="odsUsers" ShowHeadersWhenNoRecords="true">
            <PagerStyle  Mode="NextPrev" Font-Size="11px" Font-Names="tahoma"  NextPageImageUrl="../img/Grid/PagingNext.gif" PrevPageImageUrl="../img/Grid/PagingPrev.gif" >
            </PagerStyle>
<Columns>
    -------
   -------
</Columns>

Thanks,
Gijo Joseph.

</MasterTableView >
</telerik:RadGrid>
sony
Top achievements
Rank 1
 answered on 15 May 2009
1 answer
158 views
Hi,
The following code disable the textboxes when "Add a new record" button is pressed.  But i cannot able to disable the textboxes when i press "edit" button. Please write a code for me when "edit" button is pressed.

 Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles RadGrid1.ItemDataBound 
        If (TypeOf e.Item Is GridEditFormInsertItem) AndAlso (e.Item.OwnerTableView.IsItemInserted) Then 
            Dim insertItem As GridEditFormInsertItem = DirectCast(e.Item, GridEditFormInsertItem) 
            Dim txtbx1 As TextBox = DirectCast(insertItem("RUYear").Controls(0), TextBox) 
            txtbx1.Text = Year(Now) 
            Dim txtbx2 As TextBox = DirectCast(insertItem("RUMonth").Controls(0), TextBox) 
            txtbx2.Text = Month(Now) 
            txtbx1.Enabled = False 
            txtbx2.Enabled = False 
        End If 
End Sub 

Thanks.

Regards
Syed Arshad
Princy
Top achievements
Rank 2
 answered on 15 May 2009
3 answers
126 views
I have a RadGrid containing a RadDateTimePicker in a template column.  It works fine on edit, but throws error, "Specified cast is not valid" on insert for a new row. 

Here's my code for the edit template:

<

 

EditItemTemplate <telerik:RadDateTimePicker ID="RadDateTimePicker4" Runat="server" Culture="English (United States)"

 

 

 

SelectedDate='<%# Bind("Trip_Detail_Begin_Time_Stamp") %>'>

 

 

 

<TimePopupButton HoverImageUrl="" ImageUrl="" />

 

 

 

<TimeView runat="server" CellSpacing="-1"> </TimeView>

 

 

 

<Calendar runat="server" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"

 

 

 

ViewSelectorText="x"> </Calendar<DatePopupButton HoverImageUrl="" ImageUrl="" />

 

 

 

</telerik:RadDateTimePicker>

 

 

 

</EditItemTemplate>

 

 

 

 

 

 

 

 

 

 

Courtney
Top achievements
Rank 1
 answered on 15 May 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
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
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?