Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
197 views
hello to all
              good day ! i have an exporting here on my page, and my first  question is how am i going to set the width of the column to make fit on the PDF during exporting.. is there a way to set the page setup programmatically? and my second question is on CSV exporting how am i going to hide the clientselectcolumn(mycheckbox on the page) during exporting to CSV..

sample codes is higly appreciated

thanks to all
Princy
Top achievements
Rank 2
 answered on 20 May 2009
20 answers
317 views
Hello,

With the built-in skins, I see that you can set the skin that  you are using in the configuration file, in appsettings like:

<appSettings>
    <add key="Telerik.Skin" value="Web20" />
</appSettings>

If I create a custom Skin, should this approach work?

Also, is there a global place to put EnableEmbeddedSkins to false?  I don't want to have to specify that for each and every control...

Thanks.
mark
Top achievements
Rank 1
 answered on 20 May 2009
2 answers
188 views
HI Telerik

i am binding grid like this through code

GridView1.DataSource = tblsalesData;

GridView1.DataBind();

and in .aspx page it is like this

 

 

<telerik:RadGrid ID="GridView1" runat="server" AutoGenerateColumns="true" Width="940px">

 

 

 

 

 

 

<ItemStyle HorizontalAlign="right" Font-Size="10px" Font-Names="verdana" />

 

 

 

 

 

 

<AlternatingItemStyle Font-Size="10px" Font-Names="verdana" HorizontalAlign="right"/>

 

 

 

 

 

 

<HeaderStyle HorizontalAlign="Center" Font-Bold="true" Font-Size="10px"

 

 

 

 

 

 

Font-Names="Verdana"></HeaderStyle>

 

 

 

 

 

 

</telerik:RadGrid>

 

 

 

My problem is that,
 1. i want to change the horizental align to left only for 1st column.
 2. want to put thousand seperator for only first two rows data.

please guide me how to achieve this result. 

Binod
Top achievements
Rank 1
 answered on 20 May 2009
1 answer
195 views
I have a checkbox column in my datagrid like so:
<Columns> 
        <telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn"
            <HeaderTemplate> 
                <asp:CheckBox ID="cl" onclick="return check_uncheck (this );" runat="server" /> 
            </HeaderTemplate> 
            <ItemTemplate> 
                <asp:CheckBox ID="chk_record" onclick="return check_uncheck (this );" runat="server" /> 
            </ItemTemplate> 
        </telerik:GridTemplateColumn> 
        <telerik:GridBoundColumn DataField="record"  
            HeaderText="record" SortExpression="record"  
            UniqueName="record" DataType="System.Int32" ReadOnly="True"  
            Visible="False"
        </telerik:GridBoundColumn> 
<script type="text/javascript"
    function check_uncheck(Val) { 
        var ValChecked = Val.checked; 
        var ValId = Val.id; 
        var frm = document.forms[0]; 
        // Loop through all elements 
        for (i = 0; i < frm.length; i++) { 
            // Look for Header Template's Checkbox 
            //As we have not other control other than checkbox we just check following statement 
            if (this != null) { 
                if (ValId.indexOf('cl') != -1) { 
                    // Check if main checkbox is checked, 
                    // then select or deselect datagrid checkboxes 
                    if (ValChecked) 
                        frm.elements[i].checked = true
                    else 
                        frm.elements[i].checked = false
                } 
                else if (ValId.indexOf('deleteRec') != -1) { 
                    // Check if any of the checkboxes are not checked, and then uncheck top select all checkbox 
                    if (frm.elements[i].checked == false
                        frm.elements[1].checked = false
                } 
            } // if 
        } // for 
    } // function 
 
</script> 

I want the ability to run a number of different functions on this page which will use the data specified by the checkbox boolean.  I already have the grid using its row click selected event to load the nested view details, what I want now is the ability to get the row records associated with the checkboxes when something like a link button is clicked.

So how do I get the record integer value of all the checkboxes that are selected when my link button is clicked?
 Protected Sub LinkButton1_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles LinkButton1.Click 
 
'how do I loop through all of the checkboxes and get the row key (record) for all of them that are selected? 
 
    End Sub 

Shinu
Top achievements
Rank 2
 answered on 20 May 2009
1 answer
123 views
I have a rad grid which has more than 1 page.
When I click select all check box I want to select all the rows.. that is all the rows in all the pages.. not just the page that is displayed.
how can i do this.
please help asap.
thanks
Shinu
Top achievements
Rank 2
 answered on 20 May 2009
6 answers
297 views
Apparently, I have a template column for edit link, but is there a way I can make the whole row clickable so that when i click on a row, it goes to a page that i want it go to?
Alec
Top achievements
Rank 1
 answered on 20 May 2009
1 answer
174 views
Hi. I've followed the 'Load on Demand RadPageView' demo almost to the letter except with the datasource in the web user controls which hold the RadGrid's. I have them set so that the SelectCommand is set at runtime in the code behind, because it retrieves the windows userid. The grids seem to disappear when I click on a tab. I've tried setting the OnNeedDataSource but that doesn't even seem to get fired. This doesn't happen if I have the SelectCommand in the ASCX page.

Here is my ASCX page:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="PurchaseOrders.ascx.cs" 
    Inherits="workbench_PurchaseOrders" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<telerik:RadGrid ID="rgPurchaseOrders" runat="server" AllowPaging="True" AllowSorting="True" 
    DataSourceID="sdsPurchaseOrders" GridLines="None" Skin="Vista" OnNeedDataSource="rgPurchaseOrders_OnNeedDataSource">  
    <MasterTableView AutoGenerateColumns="False" DataSourceID="sdsPurchaseOrders" NoMasterRecordsText="You have no purchase orders.">  
        <RowIndicatorColumn> 
            <HeaderStyle Width="20px" /> 
        </RowIndicatorColumn> 
        <ExpandCollapseColumn> 
            <HeaderStyle Width="20px" /> 
        </ExpandCollapseColumn> 
        <AlternatingItemStyle BackColor="#F0F0F0" /> 
        <Columns> 
            <telerik:GridBoundColumn DataField="po_number" HeaderText="Order Number" SortExpression="po_number" 
                UniqueName="po_number">  
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="supplier_name" HeaderText="Supplier Name" SortExpression="supplier_name" 
                UniqueName="supplier_name">  
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="amount" DataType="System.Decimal" HeaderText="Amount" 
                SortExpression="amount" UniqueName="amount">  
            </telerik:GridBoundColumn> 
        </Columns> 
    </MasterTableView> 
</telerik:RadGrid> 
<asp:SqlDataSource ID="sdsPurchaseOrders" runat="server" ConnectionString="<%$ ConnectionStrings:FinprodConnectionString %>" /> 

And the code behind:

using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Web;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using Telerik.Web.UI;  
using System.Data.SqlClient;  
using System.Data;  
using System.Configuration;  
using Common;  
 
public partial class workbench_PurchaseOrders : System.Web.UI.UserControl  
{  
    protected void Page_Load(object sender, EventArgs e)  
    {  
        if (!Page.IsPostBack)  
        {  
            GetDataSource();  
        }  
    }  
 
    public DataTable GetDataTable(string query)  
    {  
        DataTable myDataTable = new DataTable();  
        SqlConnection myConnection = new SqlConnection(Intranet.ConString("/Default Web Site""FinprodConnectionString"));  
        try 
        {  
              
            myConnection.Open();  
            SqlDataAdapter adapter = new SqlDataAdapter();  
            adapter.SelectCommand = new SqlCommand(query, myConnection);  
 
              
 
            adapter.Fill(myDataTable);  
        }  
        finally 
        {  
            myConnection.Close();  
        }  
 
        return myDataTable;  
    }  
 
    protected void rgPurchaseOrders_OnNeedDataSource(object source, GridNeedDataSourceEventArgs e)  
    {  
        GetDataSource();  
    }  
 
    void GetDataSource()  
    {  
        string userID = HttpContext.Current.User.Identity.Name.ToString().Replace("COUNCIL\\""");  
        string sqlStr = "SELECT PORDNBR AS po_number, SUPP_NAME AS supplier_name, PORD_TOT_INC_AMT2 AS amount FROM PUF_ORD_CTL WHERE (ORIG_AUTH_CODE = '" + userID + "') AND (PORD_STATUS = 'A' OR PORD_STATUS = 'D') ORDER BY PORDNBR";  
        rgPurchaseOrders.DataSource = GetDataTable(sqlStr);  
    }  
Daniel
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 20 May 2009
2 answers
431 views
I am trying to use http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multicolumncombo/defaultcs.aspx sample to create a multicolumn combo box in my application.

I have set the "HighlightTemplatedItems=true" which highlight the rows as I hover my cursor over the rows. But I am missing the style applied to header (the backgound) and my column width for each row varies based on the length of the data. I guess I am missing a stylesheet. Can you please help me locate the stylesheet that I can use.

I am using Office2007 skin for the combobox.

Thanks,
mss
PPSDevs
Top achievements
Rank 1
 answered on 19 May 2009
3 answers
206 views
OS: XP SP2
Browser: IE7
Telerik: 2008.2.826.20

I have a radgrid with an Heirarchy and get an error when I am editing a parent record if I try and expand the children below it. This error only appears when trying to edit the parent and attempt to expand the children.

1. I Click on the pencil Edit icon on the parent row.This will open the option to alter the Priority number (this is a read only field).
2. While this window is open, click on the + sign used to expand the children grid relating to this info.
3. An error appears:

"There was a problem extracting DataKeyValues from the DataSource.  Please ensure that DataKeyNames are specified correctly and all fields specified exist in the DataSource."


Code of my Radgrid:
<telerik:RadGrid ID="rgGroupInformation" runat="server" AutoGenerateColumns="False" 
                GridLines="None" Skin="Office2007" OnDetailTableDataBind="rgGroupInformation_DetailTableDataBind" 
                OnItemCommand="rgGroupInformation_ItemCommand" OnUpdateCommand="rgGroupInformation_UpdateCommand" 
                AllowPaging="True" Height="100%" Width="860px" OnNeedDataSource="rgGroupInformation_NeedDataSource">  
                <MasterTableView EditMode="InPlace" DataKeyNames="BatchGroupId">  
                    <DetailTables> 
                        <telerik:GridTableView runat="server" DataKeyNames="BatchId,AssignedUserId,DocumentCount" 
                            DataMember="GroupDetails" EditMode="InPlace">  
                            <ParentTableRelation> 
                                <telerik:GridRelationFields DetailKeyField="BatchGroupId" MasterKeyField="BatchGroupId" /> 
                            </ParentTableRelation> 
                            <RowIndicatorColumn> 
                                <HeaderStyle Width="20px" /> 
                            </RowIndicatorColumn> 
                            <ExpandCollapseColumn> 
                                <HeaderStyle Width="20px" /> 
                            </ExpandCollapseColumn> 
                            <Columns> 
                                <telerik:GridEditCommandColumn ButtonType="ImageButton">  
                                    <HeaderStyle Width="8%" /> 
                                </telerik:GridEditCommandColumn> 
                                <telerik:GridBoundColumn DataField="CustodianName" HeaderText="Custodian" ReadOnly="True" 
                                    UniqueName="Custodian">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridTemplateColumn HeaderText="Assigned User" UniqueName="UserName" DataField="UserName">  
                                    <EditItemTemplate> 
                                        <asp:DropDownList ID="UserName" runat="server" DataTextField="UserName" DataValueField="UserId" 
                                            DataSource='<%#FillddlUserName() %>' OnDataBound="UserName_DataBound">  
                                        </asp:DropDownList> 
                                    </EditItemTemplate> 
                                    <ItemTemplate> 
                                        <asp:Label runat="server" ID="UserName" Text='<%#bind("UserName") %>'></asp:Label> 
                                    </ItemTemplate> 
                                </telerik:GridTemplateColumn> 
                                <telerik:GridBoundColumn DataField="Priority" HeaderText="Priority" UniqueName="Priority">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridCheckBoxColumn DataField="OnHold" HeaderText="On Hold" UniqueName="OnHold">  
                                </telerik:GridCheckBoxColumn> 
                                <telerik:GridBoundColumn DataField="StartDocRange" HeaderText="Start Doc Range" ReadOnly="True" 
                                    UniqueName="StartDocRange">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="EndDocRange" HeaderText="End Doc Range" ReadOnly="True" 
                                    UniqueName="EndDocRange">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="DocumentCount" HeaderText="Document Count" UniqueName="DocCount">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridTemplateColumn UniqueName="TemplateColumn1">  
                                    <ItemTemplate> 
                                        <asp:LinkButton ID="imgBtnDelete" runat="server" CausesValidation="False" CommandArgument="" 
                                            CommandName="DeleteBatch" ForeColor="#044A7E" OnClientClick="javascript:if(!confirm('This action will delete the selected batch. Are you sure?')){return false;}" 
                                            Text="Delete" /> 
                                    </ItemTemplate> 
                                    <HeaderStyle Width="8%" /> 
                                </telerik:GridTemplateColumn> 
                            </Columns> 
                        </telerik:GridTableView> 
                    </DetailTables> 
                    <RowIndicatorColumn> 
                        <HeaderStyle Width="20px" /> 
                    </RowIndicatorColumn> 
                    <ExpandCollapseColumn Visible="True">  
                        <HeaderStyle Width="20px" /> 
                    </ExpandCollapseColumn> 
                    <Columns> 
                        <%--<telerik:GridEditCommandColumn ButtonType="ImageButton" EditText="Edit">  
                                        </telerik:GridEditCommandColumn>--%> 
                        <telerik:GridEditCommandColumn ButtonType="ImageButton">  
                            <HeaderStyle Width="8%" /> 
                        </telerik:GridEditCommandColumn> 
                        <telerik:GridBoundColumn DataField="CriteriaValue" HeaderText="Criteria Value" ReadOnly="True" 
                            UniqueName="CriteriaValue">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="BatchCount" HeaderText="Batch Count" ReadOnly="True" 
                            UniqueName="BatchCount">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="Priority" HeaderText="Priority" UniqueName="Priority" 
                            ReadOnly="false">  
                        </telerik:GridBoundColumn> 
                        <telerik:GridCheckBoxColumn DataField="OnHold" HeaderText="On Hold" UniqueName="OnHold" 
                            ReadOnly="false">  
                            <HeaderStyle Width="10%" /> 
                        </telerik:GridCheckBoxColumn> 
                        <telerik:GridTemplateColumn UniqueName="TemplateColumn1">  
                            <ItemTemplate> 
                                <asp:LinkButton ID="imgBtnDelete" runat="server" CausesValidation="False" CommandArgument="" 
                                    CommandName="Delete" ForeColor="#044A7E" OnClientClick="javascript:if(!confirm('This action will delete the selected batch. Are you sure?')){return false;}" 
                                    Text="Delete" /> 
                            </ItemTemplate> 
                            <HeaderStyle Width="8%" /> 
                        </telerik:GridTemplateColumn> 
                    </Columns> 
                    <EditFormSettings> 
                        <EditColumn UniqueName="EditCommandColumn1">  
                        </EditColumn> 
                    </EditFormSettings> 
                    <PagerStyle Mode="NextPrevAndNumeric" /> 
                </MasterTableView> 
                <ClientSettings> 
                    <Scrolling AllowScroll="True" UseStaticHeaders="True" /> 
                </ClientSettings> 
                <FilterMenu EnableTheming="True">  
                    <CollapseAnimation Duration="200" Type="OutQuint" /> 
                </FilterMenu> 
            </telerik:RadGrid> 

I Stepped through my code on the back end and I have the following method where this error appears:
 protected void rgGroupInformation_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e)  
    {  
        GridDataItem parentItem = e.DetailTableView.ParentItem as GridDataItem;  
 
        if (parentItem.Edit)  
        {  
            return;  
        }  
 
        if (e.DetailTableView.DataMember == "GroupDetails")  
        {  
            DataTable batchList = new DataTable("BatchList");  
            batchList = BindBatchDetailInformation(Convert.ToInt32(lblBatchCriteriaId.Text.Trim()));  
            e.DetailTableView.DataSource = batchList;  
        }  
 
 
    }  
 
Since my parentItem.Edit is true, it goes into the if statement and exits the rgGroupInformation_DetailTableDatabind() method. If I comment out this conditional, the radgrid will allow the child grid to expand and show the items. I suspect there has to be a more graceful way to exit this method.
Eric R
Top achievements
Rank 1
 answered on 19 May 2009
2 answers
163 views
I'm calling __doPostback in the onClientClose method and the entire page is "flashing" as it reloads.   My code is below.    Each commented out section has been tried to the same effect which makes me think the rad code block might be the issue???

 

 

 

            function OnClientClose(sender, eventArgs)  
            {  
                var toPage = eventArgs.get_argument();  
                if (toPage)  
                {  
                    // process the arg and route as needed...  
                    document.location = toPage;  
                }  
                else  
                {  
                    var button = document.getElementById('<%=temp.ClientID %>');  
                    //button.click();  
                    
                    //var pageId = '<%=  Page.ClientID %>';  
                    //__doPostBack(pageId, 'UpdateCart');  
                    
                    // put code in here to update the header and the cart when fired...  
                    //__doPostBack('tctl00$UpdatePanelCart', '');  
                }  
            }  
          
 

 

 

Kevin
Top achievements
Rank 1
 answered on 19 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?