Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
103 views
This is my default.aspx
<form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
            <telerik:RadGrid ID="RadGrid1" runat="server"
                GridLines="None">
                <MasterTableView>
                    <CommandItemSettings ExportToPdfText="Export to Pdf" />
                    <RowIndicatorColumn>
                        <HeaderStyle Width="20px" />
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn>
                        <HeaderStyle Width="20px" />
                    </ExpandCollapseColumn>
                </MasterTableView>
            </telerik:RadGrid>
     
        <telerik:RadTreeView ID="RadTreeView1" Runat="server" CheckChildNodes="True"
            CheckBoxes="True" TriStateCheckBoxes="False" EnableDragAndDrop="True"
            EnableDragAndDropBetweenNodes="True" onnodedrop="RadTreeView1_NodeDrop" MultipleSelect="true"  >
            <Nodes>
                <telerik:RadTreeNode runat="server" Text="ThanhPho" Checkable="false"
                    AllowDrag="False">
                    <Nodes>
                        <telerik:RadTreeNode runat="server" Text="HCM" Checkable="False">
                        </telerik:RadTreeNode>
                        <telerik:RadTreeNode runat="server" Text="HaNoi" Checkable="False">
                        </telerik:RadTreeNode>
                        <telerik:RadTreeNode runat="server" Text="DaLat" Checkable="False">
                            <Nodes>
                                <telerik:RadTreeNode runat="server" Text="Ho Xuân Hương" Checkable="true">
                                </telerik:RadTreeNode>
                                <telerik:RadTreeNode runat="server" Text="Thung Lũng Tình Yêu" Checkable="true">
                                </telerik:RadTreeNode>
                            </Nodes>
                        </telerik:RadTreeNode>
                    </Nodes>
                </telerik:RadTreeNode>
                <telerik:RadTreeNode runat="server" Text="Đất Nước" Checkable="false">
                    <Nodes>
                        <telerik:RadTreeNode runat="server" Text="Việt Nam">
                        </telerik:RadTreeNode>
                        <telerik:RadTreeNode runat="server" Text="Singapor">
                        </telerik:RadTreeNode>
                        <telerik:RadTreeNode runat="server" Text="Japan">
                        </telerik:RadTreeNode>
                    </Nodes>
                </telerik:RadTreeNode>
            </Nodes>
        </telerik:RadTreeView>
         
    <asp:Panel ID="Panel1" runat="server" Height="256px">
    <div>
     
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <telerik:RadTextBox ID="RadTextBox1" Runat="server">
            </telerik:RadTextBox>
            <br />
         
         
    </div>
    </asp:Panel>
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadTreeView1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" UpdatePanelHeight="" />
                    <telerik:AjaxUpdatedControl ControlID="Panel1" UpdatePanelHeight="" />
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelHeight="" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    </form>
</body>

And this is my code-behind.
protected void Page_Load(object sender, EventArgs e)
        {
             
                PopulateGrid();
                RadGrid1.Rebind();
            
        }
 
        protected void RadTreeView1_NodeDrop(object sender, Telerik.Web.UI.RadTreeNodeDragDropEventArgs e)
        {
            RadTreeNode sourceNode = e.SourceDragNode;
            RadTreeNode DesNode = e.DestDragNode;
            RadTreeViewDropPosition DropPosition = e.DropPosition;
            if (DesNode != null)
            {
                 
                if (sourceNode.TreeView.SelectedNodes.Count <= 1)
                {
                    PerformDragDrop(DropPosition, sourceNode, DesNode);
                }
                else if (sourceNode.TreeView.SelectedNodes.Count > 1)
                {
                    foreach (RadTreeNode node in sourceNode.TreeView.SelectedNodes)
                    {
                        PerformDragDrop(DropPosition, node, DesNode);
                    }
                }
                DesNode.Expanded = true;
                 
                sourceNode.TreeView.UnselectAllNodes();
            }
            else if (e.HtmlElementID == "TextBox1")
            {
                
                foreach (RadTreeNode node in e.DraggedNodes)
                {
                    TextBox1.Text = node.Text;
                    RadTextBox1.Text = node.Text;
                }
                //DataTable dt = (DataTable)Session["DaTatable"];
                //foreach (RadTreeNode node in e.DraggedNodes)
                //{
                //    string[] value = { node.Text, node.Value };
                //    dt.Rows.Add(value);
                //    RadGrid1.DataSource = dt;
                //    RadGrid1.DataBind();
                //    RadGrid1.Rebind();
                //}
            }
            else if (e.HtmlElementID == RadGrid1.ClientID)
            {
               
                DataTable dt = (DataTable)Session["DaTatable"];
                foreach (RadTreeNode node in e.DraggedNodes)
                {
                    string[] value = { node.Text, node.Value };
                    dt.Rows.Add(value);
                    RadGrid1.DataSource = dt;
                    RadGrid1.DataBind();
                    RadGrid1.Rebind();
                }
            }
 
        }
        private static void PerformDragDrop(RadTreeViewDropPosition DropPosition, RadTreeNode sourceNode, RadTreeNode desNode)
        {
            switch (DropPosition)
            {
                case RadTreeViewDropPosition.Over:
                    // child
                    if (!sourceNode.IsAncestorOf(desNode))
                    {
                        sourceNode.Owner.Nodes.Remove(sourceNode);
                        desNode.Nodes.Add(sourceNode);
                    }
                    break;
                case RadTreeViewDropPosition.Above:
                    // sibling - above
                    sourceNode.Owner.Nodes.Remove(sourceNode);
                    desNode.InsertBefore(sourceNode);
                    break;
                case RadTreeViewDropPosition.Below:
                    // sibling - below
                    sourceNode.Owner.Nodes.Remove(sourceNode);
                    desNode.InsertAfter(sourceNode);
                    break;
            }
        }
        private void PopulateGrid()
        {
            string[] values = { "One", "Two" };
 
            DataTable dt = new DataTable();
            dt.Columns.Add("Item");
            dt.Columns.Add("Price");
            //dt.Columns.Add("Category");
            //dt.Rows[0]["Item"]=values[0];
            //dt.Rows[0]["Price"] = values[1];
            dt.Rows.Add(values);
            dt.Rows.Add(values);
            Session["DataTable"] = dt;
 
            RadGrid1.DataSource = dt;
            RadGrid1.DataBind();
            RadGrid1.Rebind();
        }
When I dragged and dropped item treeview to textbox >>> It was fine. But when I dragged and dropped item treeview to radgrid >>> It didn't work . I had tested when I dragged and dropped into radgrid with a message alert >>> seem my "(e.HtmlElementID == RadGrid1.ClientID)" doesn't work because no message appeared. >>>> What 's wrong ???? Thanks a lot !!!
Nikolay Tsenkov
Telerik team
 answered on 27 Oct 2010
3 answers
120 views
Hi, I am have a point chart, and i want each point on the graph to be different,
So for example i have the following table of data

Name        Value
Company    1
Average      4
Max             5

I don't want to have a legend showing, so for each point, i need a different symbol and a the name next to each point.
Is that possible??

I have included my code below

Thanks

Simon

reports rep = new reports();
rcTechnicalDesignSpend.DataSource = rep.TestData();
rcTechnicalDesignSpend.DataGroupColumn = "Name";
rcTechnicalDesignSpend.PlotArea.XAxis.DataLabelsColumn = "Value";
rcTechnicalDesignSpend.PlotArea.YAxis.MaxValue = 0;
rcTechnicalDesignSpend.Legend.Appearance.GroupNameFormat = "#VALUE";
rcTechnicalDesignSpend.DataBind();
<telerik:RadChart ID="rcTechnicalDesignSpend" runat="server" DefaultType="Point" 
        BorderWidth="0" SeriesOrientation="Horizontal" Skin="Blue" 
        EnableTheming="False" Height="25px">
        <Series>
        <telerik:ChartSeries Appearance-ShowLabelConnectors="True" /> </Series>
        <Appearance>
            <Border Visible="False" />
        </Appearance>
         
        <Legend Visible="False">
            <Appearance Visible="False">
                <ItemTextAppearance TextProperties-Color="DimGray">
                </ItemTextAppearance>
                <Border Color="DimGray" />
            </Appearance>
            <Marker Visible="False">
            </Marker>
        </Legend>
        <PlotArea>
          
            <XAxis Visible="False">
                <Appearance>
                    <MajorGridLines Color="DimGray" Width="0" />
                </Appearance>
                <AxisLabel>
                    <Appearance RotationAngle="270">
                    </Appearance>
                    <TextBlock>
                        <Appearance TextProperties-Font="Verdana, 9.75pt, style=Bold">
                        </Appearance>
                    </TextBlock>
                </AxisLabel>
            </XAxis>
            <YAxis Visible="True">
                <ScaleBreaks Enabled="True">
                    <Segments>
                        <telerik:AxisSegment MaxValue="108" MinValue="20" Name="" Step="8" />
                        <telerik:AxisSegment MaxValue="4" Name="" Step="2" />
                    </Segments>
                </ScaleBreaks>
                <Appearance EndCap="Square" MajorTick-Visible="False" MinorTick-Visible="False" 
                    StartCap="Square" Width="3" >
                    <MajorGridLines Color="DimGray" Visible="False" />
                    <MinorGridLines Visible="False" />
                    <LabelAppearance Visible="False">
                    </LabelAppearance>
                </Appearance>
                <AxisLabel>
                    <Appearance RotationAngle="0">
                    </Appearance>
                    <TextBlock>
                        <Appearance TextProperties-Font="Verdana, 9.75pt, style=Bold">
                        </Appearance>
                    </TextBlock>
                </AxisLabel>
            </YAxis>
            <YAxis2>
                <AxisLabel>
                    <Appearance RotationAngle="0">
                    </Appearance>
                    <TextBlock>
                        <Appearance TextProperties-Font="Verdana, 9.75pt, style=Bold">
                        </Appearance>
                    </TextBlock>
                </AxisLabel>
            </YAxis2>
            <Appearance Corners="Round, Round, Round, Round, 6">
                <FillStyle FillType="Solid" MainColor="White">
                </FillStyle>
                <Border Color="DimGray" Visible="False" />
            </Appearance>
        </PlotArea>
        <ChartTitle Visible="False">
            <Appearance Visible="False" Corners="Round, Round, Round, Round, 6" 
                Dimensions-Margins="4%, 10px, 14px, 0%" Position-AlignedPosition="Top">
                <FillStyle GammaCorrection="False" MainColor="224, 224, 224">
                </FillStyle>
                <Border Color="DimGray" />
            </Appearance>
            <TextBlock>
                <Appearance TextProperties-Font="Verdana, 11.25pt">
                </Appearance>
            </TextBlock>
        </ChartTitle>
    </telerik:RadChart>
Ves
Telerik team
 answered on 27 Oct 2010
1 answer
32 views
Hi
Issue1:
I am creating self hierarchy grid by using a list it's working fine,but when am generating same with data table it is throwing exception
No property or field '' exists in type 'DataRowView'.

In this scenario if i set EnableLinqExpressions="false" it is working fine,but it grid displaying parent and child hierarchy , problem is it is displaying child rows at parent level as well(two sets of child records one like parent-child relationship and second child records as normal records at parent level)

Issue2:

When I am creating self hierarchy grid with dynamic template columns(template columns are generated programatically )
not able to get hierarchy.

can anybody please suggest me..what is the problem.

Thanks in advance.
Pavlina
Telerik team
 answered on 27 Oct 2010
3 answers
86 views

Hi , 
i am using radgrid multiple grid export functionality but while click on export button i am getting below error..

RadGrid must be databound before exporting.


my grid is below...

 <div>
                
               <telerik:RadGrid ID="RadGridWrapper" runat="server" Width="550px"
            BorderStyle="None" >
            <ExportSettings OpenInNewWindow="true" />
            <MasterTableView AutoGenerateColumns="true" BorderStyle="None">
                <ItemTemplate>
                    <telerik:RadGrid ShowGroupPanel="true" AutoGenerateColumns="false" ID="grdEURPlanning"
        DataSourceID="EURPlanningDataSource"  AllowSorting="True" Width="130px"
        ShowFooter="True" runat="server" EnableLinqExpressions="false" Skin="Office2007" GridLines="Horizontal" OnPreRender="grdEURPlanning_PreRender">
        <PagerStyle Mode="NextPrevAndNumeric" />
        <MasterTableView ShowGroupFooter="true" AllowMultiColumnSorting="true"
           TableLayout="Fixed" AlternatingItemStyle-BackColor="#F2F3F5" HeaderStyle-Font-Bold="true">
                        
            <Columns>
            
                       <telerik:GridBoundColumn
                                            DataField="FinancialAccountGroupText"
                                            Visible="true"
                                            HeaderText="Category"
                                            FooterText="Total"
                                            FooterStyle-Font-Bold ="true"
                                            FooterStyle-HorizontalAlign ="Left"  
                                            HeaderStyle-Width="50px"                                           
                                        >
                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn
                                            DataField="Estimation"
                                            Visible="true"
                                            HeaderText="Estimation"
                                            DataFormatString="€{0:### ###.00}"
                                            ItemStyle-HorizontalAlign = "Right"
                                            HeaderStyle-HorizontalAlign = "Right"
                                            Aggregate = "Sum"
                                            FooterStyle-Font-Bold ="true"
                                            FooterStyle-HorizontalAlign ="Right"
                                            HeaderStyle-Width="50px"
                                        >
                                        </telerik:GridBoundColumn>
                            
                    </Columns>
                    
                       
            
                </MasterTableView>

                <ClientSettings EnableAlternatingItems="true"
                                EnableRowHoverStyle="true"
                            >
                <Selecting AllowRowSelect="True" />
                </ClientSettings>                

            </telerik:RadGrid>
                    <br />
                   <telerik:RadGrid ShowGroupPanel="true" AutoGenerateColumns="false" ID="grdEURAllocation"
        DataSourceID="EURAllocationDataSource"  AllowSorting="True" Width="390px"
        ShowFooter="True" runat="server" EnableLinqExpressions="false" Skin="Office2007" GridLines="Horizontal">
        <PagerStyle Mode="NextPrevAndNumeric" />
        
        
        <MasterTableView ShowGroupFooter="true" AllowMultiColumnSorting="true" TableLayout="Fixed"
            AlternatingItemStyle-BackColor="#F2F3F5" HeaderStyle-Font-Bold="true">
                        
            <Columns>
                        <telerik:GridBoundColumn DataField="DestinationFund" HeaderText="Fund" SortExpression="DestinationFund"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"
                            UniqueName="DestinationFund"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="30px"
                            />
                        <telerik:GridBoundColumn DataField="DestUserProj" HeaderText="User Proj" SortExpression="DestUserProj"
                            UniqueName="DestUserProj" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"
                            HeaderStyle-Width="50px"
                             />
                        <telerik:GridHyperLinkColumn DataTextField="CostCentre" HeaderText="Cost Centre" SortExpression="CostCentre"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"
                            UniqueName="CostCentre"
                            DataNavigateUrlFields="Id"
                            DataNavigateUrlFormatString="~/Allotment/Allotment.aspx?allotmentId={0}&ViewMode=ReadOnly"
                            Target="_blank"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="50px"
                            />
                        <telerik:GridBoundColumn DataField="AllotmentDate" HeaderText="Date" SortExpression="AllotmentDate"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"                            
                            UniqueName="AllotmentDate"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="60px"
                            />
                        <telerik:GridBoundColumn DataField="PlannedAmountInt" HeaderText="Amount" SortExpression="PlannedAmountInt"
                            Aggregate="Sum"
                            DataFormatString="€{0:### ### ### ###.00}"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"                            
                            UniqueName="PlannedAmountInt"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="60px"
                            />
                            
                    </Columns>               
           
            <GroupByExpressions>
                <telerik:GridGroupByExpression>
                    <GroupByFields>
                        <telerik:GridGroupByField FieldName="Fund" />
                    </GroupByFields>
                    <SelectFields>
                        <telerik:GridGroupByField FieldName="Fund" HeaderText="Fund" />
                    </SelectFields>
                </telerik:GridGroupByExpression>
            </GroupByExpressions>
            
        </MasterTableView>
        <ClientSettings AllowDragToGroup="true" EnableRowHoverStyle="true">
            <Selecting AllowRowSelect="True" />
        </ClientSettings>
        <GroupingSettings ShowUnGroupButton="true" />
    </telerik:RadGrid>
                    <br />
                   <telerik:RadGrid ShowGroupPanel="true" AutoGenerateColumns="false" ID="grdEURExpenditures"
        DataSourceID="EURExpendituresDataSource"  AllowSorting="True" Width="600px"
        ShowFooter="True" runat="server" EnableLinqExpressions="false" Skin="Office2007" GridLines="Horizontal">
        <PagerStyle Mode="NextPrevAndNumeric" />
        <MasterTableView ShowGroupFooter="true" AllowMultiColumnSorting="true"
           TableLayout="Fixed" AlternatingItemStyle-BackColor="#F2F3F5" HeaderStyle-Font-Bold="true">
                        
            <Columns>
              
                        <telerik:GridBoundColumn DataField="Fund" HeaderText="Fund" SortExpression="Fund"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"
                            UniqueName="Fund"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="25px"
                            />
                        <telerik:GridBoundColumn DataField="Account" HeaderText="Account" SortExpression="Account"
                            UniqueName="Account" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"
                             HeaderStyle-Width="35px" />
                        <telerik:GridBoundColumn DataField="UserProj" HeaderText="User Proj" SortExpression="UserProj"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"
                            UniqueName="UserProj"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="50px"
                            />
                        <telerik:GridBoundColumn DataField="CostCentre" HeaderText="Cost Centre" SortExpression="CostCentre"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"                            
                            UniqueName="CostCentre"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="50px"
                            />
                        <telerik:GridBoundColumn DataField="Unliquidated" HeaderText="Unliquidated" SortExpression="Unliquidated"
                            Aggregate="Sum"
                            DataFormatString="€{0:### ### ### ###.00}"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"                            
                            UniqueName="Unliquidated"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right"
                            HeaderStyle-Width="60px"
                            />
                            <telerik:GridBoundColumn DataField="Disbursement" HeaderText="Disbursement" SortExpression="Disbursement"
                            Aggregate="Sum"
                            DataFormatString="€{0:### ### ### ###.00}"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"                            
                            UniqueName="Disbursement"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="65px"
                            />
                            <telerik:GridBoundColumn DataField="ExtRef" HeaderText="ExtRef" SortExpression="ExtRef"
                            
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"                            
                            UniqueName="ExtRef"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="60px"
                            />
                             <telerik:GridBoundColumn DataField="ExpDate" HeaderText="Exp Date" SortExpression="ExpDate"
                            
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"                            
                            UniqueName="ExpDate"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="60px"
                            />
                            
                    </Columns>
                    
                     <GroupByExpressions>
                <telerik:GridGroupByExpression>
                    <GroupByFields>
                        <telerik:GridGroupByField FieldName="Fund" />
                    </GroupByFields>
                    <SelectFields>
                        <telerik:GridGroupByField FieldName="Fund" HeaderText="Fund" />
                    </SelectFields>
                </telerik:GridGroupByExpression>
            </GroupByExpressions>
            
                </MasterTableView>
                
        <ClientSettings AllowDragToGroup="true" EnableRowHoverStyle="true">
            <Selecting AllowRowSelect="True" />
        </ClientSettings>
        <GroupingSettings ShowUnGroupButton="true" />
                
            </telerik:RadGrid>
                </ItemTemplate>
            </MasterTableView>
        </telerik:RadGrid>
           </div>


protected void btnExportWord_Click(object sender, EventArgs e)
    {
         RadGridWrapper.MasterTableView.ExportToWord();
}

this approach i used from the  below reply...

You can try the following approach:
Export multiple RadGrids in single PDF/Excel file

Regards,
Daniel
the Telerik team



My req. is that on my page i have 3 radgrid and all different grid having no relation with each other and i want to export the data of all 3 grids into one word file.

Please help.

waiting for your reply.



Daniel
Telerik team
 answered on 27 Oct 2010
1 answer
121 views
Hello,
i use a RadGrid in a UpdatePanel. The cells contain ImageButtons.

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>        
            <telerik:RadGrid ID="RadGrid1" runat="server" Width="900px" Height="400px" 
                Skin="Office2007"  
                onitemdatabound="RadGrid1_ItemDataBound" 
                onitemcommand="RadGrid1_ItemCommand" GridLines="None" >
                <ClientSettings>
                    <Scrolling AllowScroll="true" UseStaticHeaders="true"   FrozenColumnsCount="1" SaveScrollPosition="true"/> 
                </ClientSettings
                <MasterTableView TableLayout="Auto" />
                <HeaderStyle Width="100px" />                              
            </telerik:RadGrid>        
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="RadGrid1" EventName="ItemCommand" />
        </Triggers>
</asp:UpdatePanel>

Code:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
          
        GridDataItem item = (GridDataItem)e.Item;
  
        Label lbl = new Label();
        lbl.Text = item[""].Text.Substring(item[""].Text.IndexOf("|") + 1);
        item[""].Controls.Add(lbl);
  
        for (int i = 0; i < gruppenliste.Count; i++)
        {
            ImageButton imgbtn = new ImageButton();
  
            if (item[gruppenliste[i].ToString()].Text.StartsWith("0"))
            {
                imgbtn.CommandName = "add";
                imgbtn.ImageUrl = "../img/cancel.gif";
                item[gruppenliste[i].ToString()].Controls.Add(imgbtn);
                item[gruppenliste[i].ToString()].HorizontalAlign = HorizontalAlign.Center;
                imgbtn.CommandArgument = item[""].Text.Substring(
                    0, item[""].Text.IndexOf("|")) +
                    "|" +
                    item[gruppenliste[i].ToString()].Text.Substring(
                    item[gruppenliste[i].ToString()].Text.IndexOf("|") + 1);
            }
            else
            {
  
                imgbtn.CommandName = "del";
                imgbtn.ImageUrl = "../img/ok.gif";
                item[gruppenliste[i].ToString()].Controls.Add(imgbtn);
                item[gruppenliste[i].ToString()].HorizontalAlign = HorizontalAlign.Center;
                imgbtn.CommandArgument = item[""].Text.Substring(
                    0, item[""].Text.IndexOf("|")) +
                    "|" +
                    item[gruppenliste[i].ToString()].Text.Substring(
                    item[gruppenliste[i].ToString()].Text.IndexOf("|") + 1);
            }
        }
    }
}

When I click a ImageButton, then the grid in the UpdatePanel is refreshed.
How can I automatically scroll back to the current row/column (ImageButton) after the refresh?

Reiner
Veli
Telerik team
 answered on 27 Oct 2010
1 answer
96 views
Hello !
I'm a beginner with Telerik and ASP.NET.
I would like to do something I know it is possible but I can't understand how it works.

I work with VB.NET. I have a page with code behind.
In my page, the first time it is displayed, I want to show only
 - a telerik:RadTextBox
 - and an asp:ImageButton

What I would like to do is :
When the user write some text in the radtextbox then click on the ImageButton, I want to execute in the code behind of my page, some

code with an sql query and then, if with the sql query I find in my databases the value the user has written in the radtextbox, I

would like to show a panel (just change its property VISIBLE=FALSE to TRUE) and then to fill a telerik:RadComboBox that is situated

inside the panel that is now visible.
If the sql query can't find the value, I do not show the panel and I just show an error message on the page (with a label).


I have tried so many things but I can't understand how to do this.
Thank you for your help.

This is my code in the page with the controls :
(the panel i want to change the property VISIBLE is the one with the ID="PanelMineListe" - the textbox the user uses to write the

first value is the one with the ID="RadTextBoxMine" the he clicks on the imagebutton with te id="BtImgMineValider")


<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ajax-essais.aspx.vb" Inherits="ajax_essais" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Essais</title>
</head>
<body>
 <form id="form1" runat="server">
 <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
  <asp:Panel ID="PanelRechMINE" runat="server" DefaultButton="BtImgMineValider"
           style="width:440px; padding-left:81px; height:100px; padding-top:20px; float:left;">


    <div style="float:left; position:relative; width:420px;">
      <div style="float:left; position:relative; padding-right:6px; height:28px;">
        <telerik:RadTextBox ID="RadTextBoxMine" runat="server" CssClass="BoxesOmbrees"
        EmptyMessage="Votre type Mine ici.." ValidationGroup="RechMine"
        Skin="Windows7" Width="190px"></telerik:RadTextBox>
       </div>
       <div style="float:left; position:relative; padding-right:6px;  height:28px;">
        <asp:ImageButton ID="BtImgMineValider" runat="server" Visible="true"
          ImageUrl="~/photos-francepiecesauto/commun/BtTrouver_r1_c1.png" ValidationGroup="RechMine"
                     title="Lancer une recherche.." />
       </div>
       <div style="float:left; position:relative; height:28px; font-size:10px; color:#ff0000; padding-top:6px;">
          <asp:RequiredFieldValidator ID="RequiredFieldValidatorMine1" runat="server" ControlToValidate="RadTextBoxMine"

ErrorMessage="* Type Mine requis." Display="Dynamic" ValidationGroup="RechMine" />
       </div>
    </div>



    <asp:Panel ID="PanelMineErrors1" runat="server" Visible="false" style="float:left; position:relative; width:420px; font-size:10px;

color:#ff0000;">
    <asp:Label ID="LabelMineErrors1" runat="server" />
    </asp:Panel>
    


    <asp:Panel ID="PanelMineListe" runat="server" DefaultButton="ImageButtonMineValid2" Visible="false" style="float:left;

position:relative; width:420px;">
       <div style="float:left; position:relative; padding-right:6px; width:300px; height:28px;">
             <telerik:RadComboBox ID="RadComboBoxMineListe" runat="server" MaxHeight="200px" Width="296px"
                  ValidationGroup="RechMine2" EmptyMessage="Choisissez un véhicule..." />
       </div>
       <div style="float:left; position:relative; height:28px; font-size:10px; color:#ff0000;">
          <asp:ImageButton ID="ImageButtonMineValid2" runat="server" Visible="true"
          ImageUrl="~/photos-francepiecesauto/commun/BtTrouver2_r1_c1.png" ValidationGroup="RechMine2"
                     title="Afficher le catalogue.." ToolTip="Afficher le catalogue.." />
          <asp:RequiredFieldValidator ID="RequiredFieldValidatorMine2" runat="server" style="color:#ff0000;"
                  ControlToValidate="RadComboBoxMineListe" ErrorMessage=" *" Display="Dynamic" ValidationGroup="RechMine2" />
       </div>
     </asp:Panel>




  </asp:Panel>
 </form>
</body>
</html>
Maria Ilieva
Telerik team
 answered on 27 Oct 2010
1 answer
150 views

When I try to retrive a cell value, its returning '&nbsp;' if the value is null. Is something wrong in the code?
why doesn't it just return empty string('') instead of '&nbsp;'?

Thank you
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))   
        
btnUpdate.Visible = True 
        
uc_Addr.Visible = True 
        
btnAdd.Visible = False 
        
With uc_Addr  ' uc_Addr is an User Control  
        
.Desc = row("Description").Text   
        
.Addr1 = row("Address1").Text   
        
.Addr2 = row("Address2").Text  'retuns '&nbsp;' if the cell value is null. 
        
.State.SelectedValue = row("StateID").Text   
        
.City.SelectedValue = row("CityID").Text   
        
.Zip.SelectedValue = row("ZipID").Text 
        
.Phone = row("Phone").Text  'retuns '&nbsp;' if the cell value is null.  
        
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:GridButtonColumn CommandName="Select" Text="Edit"  ButtonType="ImageButton"
            UniqueName="column1" 
            ImageUrl="Images/Edit.gif">
        </telerik:GridButtonColumn
      <telerik:GridBoundColumn DataField="Destination_ID" HeaderText="Destination_ID" visible="False" UniqueName="Destination_ID" ReadOnly="true"/>
                         <telerik:GridBoundColumn DataField="Addr_Desc" HeaderText="Description"  UniqueName="Description" ReadOnly="true"></telerik:GridBoundColumn>
                         <telerik:GridBoundColumn DataField="Addr1" HeaderText="Address1" UniqueName="Address1" ReadOnly="true"></telerik:GridBoundColumn>
                         <telerik:GridBoundColumn DataField="Addr2" HeaderText="Address2" UniqueName="Address2" ReadOnly="true"></telerik:GridBoundColumn>
                         <telerik:GridBoundColumn DataField="City" HeaderText="City" UniqueName="City" ReadOnly="true"></telerik:GridBoundColumn>
                         <telerik:GridBoundColumn DataField="State" HeaderText="State" UniqueName="State" ReadOnly="true"></telerik:GridBoundColumn>
                         <telerik:GridBoundColumn DataField="Zip" HeaderText="Zip" UniqueName="Zip" ReadOnly="true"></telerik:GridBoundColumn>
                         <telerik:GridBoundColumn DataField="Phone" HeaderText="phone" UniqueName="Phone" ReadOnly="true"></telerik:GridBoundColumn>
                         <telerik:GridBoundColumn DataField="Start_Latitude" HeaderText="Lat" UniqueName="Lattitude" ReadOnly="true"></telerik:GridBoundColumn>
                         <telerik:GridBoundColumn DataField="Start_Longitude" HeaderText="Longt" UniqueName="Longitude" ReadOnly="true"></telerik:GridBoundColumn>
                         <telerik:GridBoundColumn DataField="State_ID" UniqueName="StateID" Visible="false"></telerik:GridBoundColumn>
                         <telerik:GridBoundColumn DataField="City_ID" UniqueName="CityID" Visible="false"></telerik:GridBoundColumn>
                         <telerik:GridBoundColumn DataField="Zip_ID" UniqueName="ZipID" Visible="false"></telerik:GridBoundColumn>
                      
            <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" 
            Text="Delete" UniqueName="Delete">
        </telerik:GridButtonColumn>
                      
            </Columns>
           <EditFormSettings>
<EditColumn UniqueName="EditCommandColumn1"></EditColumn>
</EditFormSettings>
</MasterTableView>
  
  
    </telerik:RadGrid>

Daniel
Telerik team
 answered on 27 Oct 2010
1 answer
55 views
Hi,

I would like to change the horizontal selected region image of a slider control on the clientside. I have set to false the EnableEmbeddedSkins property and included a css skin file for the slider control. I see the following class in the css file

.rslHorizontal .rslSelectedregion
{
    background:url(../images/Slider/SelectedRegionHorizontalBgr.gif) right top no-repeat;
}
 But I want to change the image path on a button click.

Any help is appreciated.
Tsvetie
Telerik team
 answered on 27 Oct 2010
1 answer
123 views
Hi,

I was wondering how I could use the RadWindow in combination with the ASP.NET LoginControl?
I'd like to popup a RadWindow when a user enters the wrong login information, or when an error occurs.

Maybe someone already did this? I'm having trouble to get this working.

Thanks,
Daniel
Shinu
Top achievements
Rank 2
 answered on 27 Oct 2010
5 answers
223 views
I have a page that contains the RadScheduler component.  The appointments (subject) display fine in DayView and MonthView modes.  However, in Weekview mode the only appointments that appear to display correctly are ones where there is only one appointment for the timeslot.  If there are more than one, they use a fraction of the space in the current cell.

For example:

  • If I have one appointment for 9:00am, it displays fine
  • If I have two appointments for 9:00am, the first appointment uses only half the width of the cell (instead of the full width), and the second appointment displays the same way directly underneath the first
  • If I have three appointments for 9:00am, the first appointment uses only one third of the width of the cell (instead of the full width), and the second and third appointments display the same way directly underneath the first.

My goal is for each appointment subject to use the entire width of a cell.  If there is more than one appointment for a specific timeslot, they should display vertically in the cell -- not horizontally.

I sample screen shot of the problem is attached.  How do I obtain this result? 

Regards,
Dan M
Veronica
Telerik team
 answered on 27 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?