Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
92 views
hi.
thank you for your help.
 i wonder to ask about a way to read data from an XML file and insert them to a rad list box.
my xml structure is like this:
<Title>
    <Images>
        <Image> 1.jpg</Image>
        <text>something</text>
     <Images>
    .
     .
       .
<Title>
i want to load value of <image> tag into image url propertie and value of <text> tag to text propertie of each item in radlistbox.

Dimitar Terziev
Telerik team
 answered on 31 Aug 2011
2 answers
522 views
I have a chart that is displaying 365 days of data and I want the X axis labeled only by month. Seems like a simple request but after spending considerable time looking at documentation and numerous forum posts, it looks like it is not as easy as it seems. I have also included an image of how my chart renders. I can get the range on the x axis to display fine however the plotted line does not extend to the end of the graph. Even if the monthly labels are impossible to achieve, I need to AT LEAST get that plotted line to scale to the end of the graph. Of course when I turn the auto scaling on the X axis range does not work.

Here is my chart and code behind.

<telerik:RadChart ID="rc1" runat="server" DataSourceID="SqlDataSource1" DefaultType="Line"
    Width="600px">
    <Series>
        <telerik:ChartSeries DataYColumn="ClosePrice" Name="ClosePrice" Type="Line">
            <Appearance ShowLabels="false">
                <FillStyle MainColor="213, 247, 255">
                </FillStyle>
            </Appearance>
        </telerik:ChartSeries>
    </Series>
    <Legend Visible="False">
        <Appearance Visible="False">
        </Appearance>
    </Legend>
    <PlotArea XAxis-AutoScale="False">
        <Appearance Dimensions-Margins="18%, 5%, 22%, 10%">
        </Appearance>
        <XAxis LayoutMode="Inside" AutoScale="false" LabelStep="45">
            <Appearance ValueFormat="ShortDate" MajorGridLines-Visible="false">
                <LabelAppearance RotationAngle="45" Position-AlignedPosition="Top">
                </LabelAppearance>
            </Appearance>
        </XAxis>
        <YAxis IsZeroBased="false" AxisMode="Extended">
        </YAxis>
    </PlotArea>
    <ChartTitle>
        <TextBlock Text="Title Here" />
    </ChartTitle>
</telerik:RadChart>

SqlDataSource1.SelectCommand = "select * from BofIHistoricalData where datadate between '" + 
            DateTime.Now.Date.AddMonths(-12).ToString() + "' and '" + DateTime.Now.Date.AddDays(-1) + "'" +
            "order by datadate";
               
            double today = DateTime.Now.Date.ToOADate();
            double lastYear = DateTime.Now.Date.AddMonths(-12).ToOADate();
            rc1.PlotArea.XAxis.AddRange(lastYear, today, 1);
Tony
Top achievements
Rank 1
 answered on 31 Aug 2011
5 answers
388 views
 

Hi

I am using RadGrid With Paging(Mode:NextPrevAndNumeric).

Issue:-

The Problem is when i change the Page Size From the dropdown Let's say 2 to 10. then there is no record Display even the Grid has 5 records.

This Problems has Come after I implemented the "expand/collapse images when no records" in the grid followed your tetelrik article.

If I do the, Hieararchy Load Mode="Server" or remove "expand/collapse images when no records" behaviour then it's works fine.

But I need Both feature..

I also Attached the Code and Images

 

<

 

telerik:RadGrid AutoGenerateColumns="False" ID="rgSurvey" AllowPaging="True" AllowSorting="True"

 

                AllowCustomPaging="True" AllowAutomaticInserts="false" AllowAutomaticUpdates="false"
                AllowAutomaticDeletes="true" OnItemCommand="rgSurvey_ItemCommand" OnSortCommand="rgSurvey_SortCommand"
                OnNeedDataSource="rgSurvey_NeedDataSource" runat="server" Skin="Office2007" PageSize="20"
                ShowGroupPanel="false" ClientSettings-AllowDragToGroup="true" ClientSettings-AlowExpandCollapse="true"
                OnDetailTableDataBind="rgSurvey_DetailTableDataBind" DataMember="SurveyTemplateID"
                OnItemDataBound="rgSurvey_ItemDataBound"  OnPreRender="rgSurvey_PreRender"
                <PagerStyle Mode="NextPrevAndNumeric" />
                <MasterTableView TableLayout="Fixed" DataKeyNames="SurveyTemplateID" HierarchyDefaultExpanded="false"
                    CommandItemDisplay="None" CommandItemSettings-AddNewRecordText="Add New User" HierarchyLoadMode="Client">
                    <DetailTables>
                        <telerik:GridTableView AllowPaging="false" AllowSorting="false" >
                            <Columns>
<telerik:GridTemplateColumn UniqueName="LockUnlock" HeaderText="" HeaderStyle-Width="70"
                                        ItemStyle-HorizontalAlign="Center" ItemStyle-Width="70">
                                        <itemtemplate
                                         <asp:ImageButton ID="Image1" runat="server" OnClientClick="return checkuserlock(this);" CommandName="UnlockSurvey" /> <br />
                                         <asp:Label ID="lblLockUserName" runat="server" Text='<%# Eval("LockUserName") %>' />
                                         <asp:Label ID="lblInnerLockUserId" runat="server" Text='<%# Eval("LockUserID") %>' style="display:none;"></asp:Label>
                                       </itemtemplate>
                                       </telerik:GridTemplateColumn>                                
                                <telerik:GridBoundColumn HeaderText="Version" DataField="SurveyVersion" HeaderStyle-Width="40">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="ID" DataField="SurveyTemplateID" UniqueName="SurveyTemplateID"
                                    SortExpression="SurveyTemplateID" HeaderStyle-Width="40" />
                                <telerik:GridButtonColumn HeaderText="Title" DataTextField="SurveyName" UniqueName="SurveyName"
                                    ItemStyle-Font-Bold="false" SortExpression="SurveyName" CommandName="editcontent" />
                                <telerik:GridBoundColumn HeaderText="Created By" DataField="UserNAME">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Last Updated By" DataField="LastUpdatedUser">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Approved By" DataField="ApprovedBy">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Active Date" DataField="ActiveDate">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Termination Date" DataField="TerminationDate">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Approval Status" DataField="ApprovalStatus">
                                </telerik:GridBoundColumn>
                                 <telerik:GridBoundColumn HeaderText="" DataField="LockUserID" Visible="false">
                            </telerik:GridBoundColumn>
                            </Columns>
                        </telerik:GridTableView>
                    </DetailTables>
                    <Columns>
<telerik:GridTemplateColumn UniqueName="LockUnlock" HeaderText="" HeaderStyle-Width="70"
                            ItemStyle-HorizontalAlign="Center" ItemStyle-Width="70">
                            <ItemTemplate>
                                <asp:ImageButton ID="Image1" runat="server" OnClientClick="return checkuserlock(this);" CommandName="UnlockSurvey"/><br />
                                <asp:Label ID="lblLockUserName" runat="server" Text='<%# Eval("LockUserName") %>' />
                                <asp:Label ID="lblLockUserId" runat="server" Text='<%# Eval("LockUserID") %>' style="display:none;"></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn HeaderText="Version" DataField="SurveyVersion" HeaderStyle-Width="40">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="ID" DataField="SurveyTemplateID" UniqueName="SurveyTemplateID"
                            SortExpression="SurveyTemplateID" HeaderStyle-Width="40" />
                        <telerik:GridButtonColumn HeaderText="Title" DataTextField="SurveyName" UniqueName="SurveyName"
                            ItemStyle-Font-Bold="true" ItemStyle-ForeColor="Red" SortExpression="SurveyName"
                            CommandName="editcontent" />
                        <telerik:GridBoundColumn HeaderText="Created By" DataField="UserNAME" SortExpression="UserNAME">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Last Updated By" DataField="LastUpdatedUser"
                            SortExpression="LastUpdatedUser">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Approved By" DataField="ApprovedBy" SortExpression="ApprovedBy">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Active Date" DataField="ActiveDate" SortExpression="ActiveDate">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Termination Date" DataField="TerminationDate"
                            SortExpression="TerminationDate">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Approval Status" DataField="ApprovalStatus"
                            SortExpression="ApprovalStatus">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="" DataField="LockUserID" Visible="false">
                        </telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
  
protected override void OnLoad(EventArgs e)
        {
  
            base.OnLoad(e);
  
            if (!Page.IsPostBack)
            {
 this.rgSurvey.PageSize = 2;
  }
        }
  
 protected void rgSurvey_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            if (!e.IsFromDetailTable)
            {
                                SetSurveyContentGridDataSource();
               
                            }
        }
  
  
  
  private void SetSurveyContentGridDataSource()
        {
            int totalRecord = 0;
            this.rgSurvey.DataSource = GetSearchBySurvey(ref totalRecord);
            this.rgSurvey.VirtualItemCount = totalRecord;
                   }
  
private List<GetSearchSurveyResult_Result> GetSearchBySurvey(ref int totalRecord)
        {
            string approvalstatus = string.Empty;
            SurveyQuestionBL oSurveyCategory = new SurveyQuestionBL();
            int pageSize = this.rgSurvey.PageSize;
            string sortExpression = GetSortedColumnName("SURVEY");
            string sortDirection = GetSortedDirection("SURVEY");
  
            foreach (ListItem li in cbApprovalStatus.Items)
            {
                if (li.Selected == true)
                {
                    approvalstatus += li.Value + ",";
                }
            }
            GetSearchSurveyResult_Result obj = new GetSearchSurveyResult_Result
            {
                SurveyTemplateID = txtSurveyID.Text.Length > 0 ? Convert.ToInt32(txtSurveyID.Text) : 0,
                SurveyName = txtSurveyTitle.Text,
                SurveyScopeID = Convert.ToInt32(rblScope.SelectedValue),
                ApprovalStatusID = approvalstatus,
                ClientID = Convert.ToInt32(rblScope.SelectedValue) ==(int) Scope.ClientSpecific ? (int?)Convert.ToInt32(ddlClientList.SelectedValue) : null
  
            };
            //int pageSize = this.rgSurvey.PageSize;
            var list = oSurveyCategory.GetAllSurveyResult(pageSize, obj, rgSurvey.CurrentPageIndex, ref totalRecord, sortExpression, sortDirection);
            oSurveyCategory = null;
            return list;
  
        }
  
protected void rgSurvey_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
        {
            SurveyQuestionBL oReportingCategory = new SurveyQuestionBL();
            // int record;          
            GridDataItem parentItem = e.DetailTableView.ParentItem as GridDataItem;
            string surveyTemplateID = parentItem.GetDataKeyValue("SurveyTemplateID").ToString();
            this.rgSurvey.DataSource = oReportingCategory.GetNestedSurveyById(Convert.ToInt32(surveyTemplateID));
            //this.rgSurvey.AllowPaging = false;
  
  
        }
  
  protected void rgSurvey_PreRender(object sender, EventArgs e)
        {
            HideExpandColumnRecursive(rgSurvey.MasterTableView);
        }
        public void HideExpandColumnRecursive(GridTableView tableView)
        {
            GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView);
            foreach (GridNestedViewItem nestedViewItem in nestedViewItems)
            {
                foreach (GridTableView nestedView in nestedViewItem.NestedTableViews)
                {
                    if (nestedView.Items.Count == 0)
                    {
                        TableCell cell = nestedView.ParentItem["ExpandColumn"];
                        cell.Controls[0].Visible = false;
                        nestedViewItem.Visible = false;
                    }
                    if (nestedView.HasDetailTables)
                    {
                        HideExpandColumnRecursive(nestedView);
                    }
                }
            }
        }
  
 protected void rgSurvey_SortCommand(object source, GridSortCommandEventArgs e)
        {
            // if (rblSearchType.SelectedValue == "1")
            //{
            SetSortedColumnName("SURVEY", e.CommandArgument.ToString());
            SetSortedDirection("SURVEY", e.NewSortOrder.ToString());
            BindContentSurveyGrid();
}
  protected void rgSurvey_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            Int32 SurveyId, dbResult;
            int LockUserID, Edit;
            SurveyQuestionBL oReportingCategory;
            if (e.CommandName == "editcontent")
            {
  
                oReportingCategory = new SurveyQuestionBL();
                GridDataItem item = (GridDataItem)e.Item;
                SurveyId = Convert.ToInt32(item["SurveyTemplateID"].Text);
                LockUserID = Convert.ToInt32(item["LockUserID"].Text);
  
                if (LockUserID == 0 || LockUserID == base.UserID)
                {
                    dbResult = oReportingCategory.InsertSurveyForLockUnlock(base.UserID, SurveyId);
                    Edit = 1;
                }
                else
                {
                    Edit = 2;
                }
  
                Response.Redirect("~/Survey/AddSurvey.aspx?SID=" + SurveyId + "&Edit=" + Edit, true);
  
  
  
            }
            else if (e.CommandName == "UnlockSurvey")
            {
                oReportingCategory = new SurveyQuestionBL();
                GridDataItem item = (GridDataItem)e.Item;
                SurveyId = Convert.ToInt32(item["SurveyTemplateID"].Text);
                dbResult = oReportingCategory.InsertSurveyForLockUnlock(null, SurveyId);
                rgSurvey.Rebind();
  
  
            }
            else if (e.CommandName == "ChangePageSize")
            {
                rgSurvey.PageSize = ((Telerik.Web.UI.GridPageSizeChangedEventArgs)(e)).NewPageSize;
                rgSurvey.Rebind();
            }
        }


Please Provide The Solution ASAP.

Thanks & Regards
Ashish


Ashish
Top achievements
Rank 1
 answered on 31 Aug 2011
4 answers
170 views
I am trying to get the Demo code working in my project with the Grid / Scheduler drag and drop demo and I am getting an error from the java-script function rowDropping. This line is throwing the error:

$get("TargetSlotHiddenField").value = timeSlot.get_index();

The error I get is: "Microsoft JScript runtime error: Unable to set value of the property 'value' : object is null or undefined"

I am not sure what I am missing, I have looked through the demo code several times.

Thanks!
Clark

Plamen
Telerik team
 answered on 31 Aug 2011
1 answer
91 views
avatar

Posted 2 minutes ago (permalink)

I have web application which perfectly works fine when i run through my local asp.net development server , but the problem is none of the radcontrols are responding when i run the same application through IIS7 , can i know what exactly the problem is?, should i make any explicit settings to make radcontrols works fine when run through the IIS7
Slav
Telerik team
 answered on 31 Aug 2011
1 answer
128 views
Hi there

Can anyone point me in the right direction with a problem that has so far stumped me? I have a RadTreeView that uses an .ascx User Control as its node template, and which displays data from a hierarchical data source - the data is a hierarchical set of 'comments' submitted by users for a blog post. All this works fine. The issue is, I am trying to work out the best way of dynamically incorporating into a node an editor control which would be displayed ONLY if a new comment needed to be added as a 'reply' to an existing comment. In other words, I'm looking for a way to only display a text area editor in a node if the 'Reply' button is pressed for a particular node. Obviously I could have a RadEditor hidden within each node template, to be shown only as and when the Reply button is pressed. BUT ... this would mean having a RadEditor control for each and every node in the treeview, and I'm pretty sure this would have rather severe performance implications. I have many many nodes, and dread to think how slow it would be to have a RadEditor control instantiated server-side for each and every node.

At the moment I just have a single RadEditor outside the treeview hierarchy, but this is not ideal as it means the reply text area is at a different place on the page to the comment in question to which the reply is being made. Instead I'm looking for a way to do something like the review pages of Amazon, which appear to re-use a single control at different positions in the comment hierarchy dynamically on demand - I haven't really managed to reverse engineer their technique yet, it seems quite complex, but it appears to involve having a single 'pre-rendered' text area/editor hidden on the page, which is then dynamically injected into the tree view at the correct location by client-side Javascript, using a Placeholder that IS already included in the node template they use (I appreciate they may well not be using the RadTreeView control, but it is something similiar). 

So my question is, are there any additional RadControls that I should be using in order to reproduce this behaviour, or what would be the recommended technique for dynamically re-using and repositioning a single editor control within the tree view hierarchy as a whole, in a way that would avoid having a RadEditor control instantiated for every single node.

Thanks very much for your advice.

Regards



Dimitar Terziev
Telerik team
 answered on 31 Aug 2011
1 answer
223 views
Hi,

I like the scheduler control, I want set the scheduler to full screen (day, week, month, timeline) via javascript, and resize it, and it's should keep full size on it parent div, how implement to this?

Thanks and best regards
Plamen
Telerik team
 answered on 31 Aug 2011
2 answers
517 views
Hi,

I am having a radgrid with template columns containing checkboxes and radcombos . And the last  template column is having a radcombobox control.

On client click of checkboxes, if  checkbox is checked radcombo should be enabled , else it should be disabled.
I want to achieve this functionality by using javascript.
Any suggestions or sample code please help..


Thanks & Regards,
siva prasad.

Jayesh Goyani
Top achievements
Rank 2
 answered on 31 Aug 2011
5 answers
308 views
Hi,

I need to disable some of the toolbar icons(Eg: Bold and Italic) on the RadEditor on button click and i should hide these on clientside .how can i achieve this.


Thanks
Srinivas
Rumen
Telerik team
 answered on 31 Aug 2011
6 answers
414 views
Hi,

 I have a simple problem but have been having a frustrating time figuring this out. I have a html table which has two rows 'trExistingCustomer' and 'trNewCustomer'. I have an edit popup form on the grid. I want to show a certain row and hide the other based on what command the grid is trying to do (Inset / Edit). I use Jquery in a RadCodeBlack to do this, I am firing a function on the ClientEvent OnPopUpShowing. how I can I check if this was triggered from Insert comand or Edit command in the javascript. I already tried using the function onCommand (Please see code) I saw another example and thought this might be the relevant function but this is not working and it displays all rows. Can someone please show an example in code how to check for the calling command in the popup function or onCommand to do this right? Also is there a list of all client side events asscociated with the edit form and the grid somewhere, I think that would be helpful to know. Any help is appreciated
HTML table in Edit popup form in RadGrid
  
   <table id="tblEditPopup" style="width:100%; height:100%">
     <tr id="trExistingCustomer" >
                              <td align="right">
                                 Select Existing Customer:
                              </td>
                              <td>
                                  <telerik:RadComboBox  ID="cboxCustomers" runat="server" AutoPostBack="true" DataSourceID="CustomerObjectDataSource" DataTextField="CustomerName" DataValueField="customer_id"  SelectedValue='<%# Bind("customer_id") %>' >
                                     
                                  </telerik:RadComboBox>
                              </td>
                               <td align="right">
                                 Abbreviation:
                               </td>
                              <td>
                                 <asp:TextBox ID="txtCustAbbreviation" runat="server" Text='<%# Bind("CustomerAbbrev") %>' ></asp:TextBox>
                               </td>
                            </tr>
  
                            <tr id="trNewCustomer" >
                               <td align="right">
                                  Customer Name:
                               </td>
                               <td>
                                 <asp:TextBox ID="txtCustomerName" runat="server" Text='<%# Bind("CustomerName") %>' ></asp:TextBox>
                               </td>
                               <td align="right">
                                 Abbreviation:
                               </td>
                               <td>
                                 <asp:TextBox ID="txtNewAbbreviation" runat="server" Text='<%# Bind("CustomerAbbrev") %>'  ></asp:TextBox>
                               </td>
                            </tr>
  
                             
  
                            <tr>
                               <td align="right">
                                  City:
                               </td>
                               <td>
                                 <asp:TextBox ID="txtCity" runat="server" Text='<%# Bind("City") %>' ></asp:TextBox>
                               </td>
                               <td align="right">
                                 State:
                               </td>
                               <td>
                                   <telerik:RadComboBox ID="cboxStates" runat="server" DataSourceID="StatesObjectDataSource" DataTextField="description" DataValueField="description" AutoPostBack="false"  SelectedValue='<%# Bind("State") %>'>
                                           
                                   </telerik:RadComboBox>
                               </td>
                            </tr>
  
                            <tr>
                              <td align="center" colspan="4" style="" >
                                 <asp:Button ID="BtnSubmit"  Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'  /> 
                                 <asp:Button ID="BtnCancel" Text="Cancel" runat="server" CausesValidation="false" CommandName="Cancel" />
                              </td>
                            </tr>
                            
                        </table>
  
  
GRID's CLIENT SIDE EVENTS
 <ClientSettings>
                <ClientEvents OnPopUpShowing="PopUpShowing" OnCommand="onCommand"  />
   </ClientSettings>
  
JAVASCRIPT
  
 <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
        
       var popUp;
                function PopUpShowing(sender, eventArgs) {
                    popUp = eventArgs.get_popUp();
  
                     //This works when the popup comes up but how can I tell if its called from the Edit or Insert command??
                        $('#trExistingCustomer').css('display', 'block');
                        $('#trNewCustomer').css('display', 'none');
  
                                      
                }
  
        //This seems a more logical place to put this but this does not work , is there another command I should be checking for??
         function onCommand(sender, args) {
  
                    if (args.get_commandName() == "InitInsert")        
                   {
                        $('#trExistingCustomer').css('display', 'block');
                        $('#trNewCustomer').css('display', 'none');
                   
                 
                   else if(args.get_commandName() == "InitEdit") {
                        $('#trExistingCustomer').css('display', 'block');
                        $('#trNewCustomer').css('display', 'none');
                   }
  
   </script>
        </telerik:RadCodeBlock>
Farhan
Top achievements
Rank 1
 answered on 31 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?