Telerik Forums
UI for ASP.NET AJAX Forum
17 answers
738 views
I have a radgrid with autoinsert, delete, edit turned on. My EditMode is INLINE. The grid has a single text column.  For edit I have it working to show a hidden column with my save button in it doing this in pre-render

if (rgTags.EditIndexes.Count > 0)
            {
                rgTags.MasterTableView.GetColumn("EditTag").Visible = false;
                rgTags.MasterTableView.GetColumn("DeleteTag").Visible = false;
                rgTags.MasterTableView.GetColumn("SaveTag").Visible = true;
            }
            else
            {
                rgTags.MasterTableView.GetColumn("EditTag").Visible = true;
                rgTags.MasterTableView.GetColumn("DeleteTag").Visible = true;
                rgTags.MasterTableView.GetColumn("SaveTag").Visible = false;
            }

I need to do the same thing for insert mode.   How can I do that?
Mayur
Top achievements
Rank 1
 answered on 08 Oct 2013
5 answers
344 views
Hi,

Im trying to use RadProgressArea to show a progress bar for custom DB task. It shows up and the progress is shown.
The issue is after completion of task, it still shows up and doesnt hide.

If i remove the RadAjaxManager updating the panel, then on completion of task the RadProgressArea goes off.


Following is the code snippet for my aspx and code behind
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm4.aspx.cs" Inherits="ProgressBarSample.WebForm4" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
     <telerik:RadScriptManager id="ScriptManager1" runat="server" />
     <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="buttonSubmit">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="Panel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" IsSticky="true">
    </telerik:RadAjaxLoadingPanel>
            <asp:Panel runat="server" ID="Panel1">
                <asp:Label ID="lbl1" runat="server"></asp:Label>
            </asp:Panel>
            <asp:button ID="buttonSubmit" runat="server" Text="Submit" OnClick="buttonSubmit_Click" CssClass="RadUploadButton" />
             
            <telerik:RadProgressManager id="Radprogressmanager1" runat="server" />
             
            <telerik:RadProgressArea id="RadProgressArea1" runat="server" />
             
            <br /><br /><br /><br /><br /><br />
    </div>
    </form>
</body>
</html>
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 Telerik.Web.UI.Upload;
 
namespace ProgressBarSample
{
    public partial class WebForm4 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //Do not display SelectedFilesCount progress indicator.
                RadProgressArea1.ProgressIndicators &= ~ProgressIndicators.SelectedFilesCount;
            }
 
            RadProgressArea1.Localization.Uploaded = "Total Progress";
            RadProgressArea1.Localization.UploadedFiles = "Progress";
            RadProgressArea1.Localization.CurrentFileName = "Custom progress in action: ";
        }
        protected void buttonSubmit_Click(object sender, System.EventArgs e)
        {
            UpdateProgressContext();
            lbl1.Text = "Updated";
        }
 
        private void UpdateProgressContext()
        {
            const int total = 100;
 
            RadProgressContext progress = RadProgressContext.Current;
            progress.Speed = "N/A";
 
            for (int i = 0; i < total; i++)
            {
                
                 
                progress.PrimaryTotal = 1;
                progress.PrimaryValue = 1;
                progress.PrimaryPercent = 100;
                int per = Convert.ToInt32((Convert.ToDouble(i) / total)*100);
                UpdateProgress(progress,total,i,per);
                progress.CurrentOperationText = "Step " + i.ToString() + " Per = " + per.ToString();
 
                if (!Response.IsClientConnected)
                {
                    //Cancel button was clicked or the browser was closed, so stop processing
                    break;
                }
 
                progress.TimeEstimated = (total - i) * 100;
                //Stall the current thread for 0.1 seconds
                System.Threading.Thread.Sleep(100);
            }
        }
        private void UpdateProgress(RadProgressContext progress,int total,int i,int per)
        {
 
                progress.SecondaryTotal = total;
                progress.SecondaryValue = i;               
                progress.SecondaryPercent = per;
        }
    }
}
Hristo Valyavicharski
Telerik team
 answered on 08 Oct 2013
17 answers
779 views
Hi,

I have used two date picker controls in my page.
frequently i am facing problem that date picker does not display image , instead it display text "Open the calender popup" as displayed in attached image.


Radoslav
Telerik team
 answered on 08 Oct 2013
3 answers
98 views
in my radgrid of Job Title, i want to add a checkboxlist to let user check/uncheck the Department Name.
That means the job title belongs to which department.

So I want to databound all department name from table "Department". 
For New Record, it will display all department name.
In Edit Mode, if user already check before, the checkbox will automatically check. How can i use OnDataBound in code behind to databound the checkbox by RadGrid DataKeyNames "ID" ?

It returns the following error when i click Add New/Edit:

 

Server Error in '/LRDB' Application.

The DataSourceID of 'CheckBoxList_Dept' must be the ID of a control of type IDataSource. A control with ID 'LDS_Dept' could not be found.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The DataSourceID of 'CheckBoxList_Dept' must be the ID of a control of type IDataSource. A control with ID 'LDS_Dept' could not be found.

Source Error:

Line 26: <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel8" runat="server"> Line 27: </telerik:RadAjaxLoadingPanel> Line 28: <telerik:RadGrid ID="RadGrid_JobTitle" runat="server" CellSpacing="0" Line 29: DataSourceID="LDS_JobTitle" width="800" PageSize="15" Line 30: GridLines="None" style="margin-top: 0px" AllowFilteringByColumn="True" 

My code as follows:

<%@ Page Title="" Language="VB" MasterPageFile="~/LRDB.master" AutoEventWireup="false" CodeFile="Admin_dictionary_JobTitle.aspx.vb" Inherits="Admin_Admin_dictionary_JobTitle" %>
 
 
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
 
</asp:Content>
 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
 
        <br />
 
        <strong><span class="style4">Job Title</span><br /> </strong><br />
 
        <telerik:RadCodeBlock ID="RadCodeBlock8" runat="server">
 
  <script type="text/javascript">
 
        function RowDblClick(sender, eventArgs) {
        sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
        }
 
        function conformbox() {
        var con = confirm("Are you sure want to delete?");
        if (con == true) {
  return true;
  }
        else {
  return false;
   }
  }
  </script>
  </telerik:RadCodeBlock>
 
 
 
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel8" runat="server">
 
        </telerik:RadAjaxLoadingPanel>
 
        <telerik:RadGrid ID="RadGrid_JobTitle" runat="server" CellSpacing="0"
        DataSourceID="LDS_JobTitle" width="800"  PageSize="15"
  GridLines="None" style="margin-top: 0px" AllowFilteringByColumn="True"
        AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
        ShowStatusBar="True" AllowAutomaticDeletes="True" AllowAutomaticInserts="false"
        AllowAutomaticUpdates="True">
         <GroupingSettings CaseSensitive="false" />
 
    <MasterTableView AutoGenerateColumns="False"

     DataKeyNames="ID" DataSourceID="LDS_JobTitle"

     AllowFilteringByColumn="False" AllowPaging="False"

     CommandItemDisplay="Top" OverrideDataSourceControlSorting="true" >

      <CommandItemSettings ExportToPdfText="Export to PDF" />

      <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"
       Visible="True">

      </RowIndicatorColumn>

      <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"
       Visible="True">

      </ExpandCollapseColumn>

      <Columns>

       <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" HeaderStyle-Width="50">

       </telerik:GridEditCommandColumn>

       <telerik:GridBoundColumn DataField="ID"
        FilterControlAltText="Filter ID column" HeaderText="ID"
        SortExpression="ID" UniqueName="ID" Visible="false">

       </telerik:GridBoundColumn>

       <telerik:GridBoundColumn DataField="Job_Title_ShortName"

        FilterControlAltText="Filter Job_Title_ShortName column" HeaderText="Short Name"

        SortExpression="Job_Title_ShortName" UniqueName="Job_Title_ShortName" HeaderStyle-Width="200">

       </telerik:GridBoundColumn>

       <telerik:GridBoundColumn DataField="Job_Title"

        FilterControlAltText="Filter Job_Title column" HeaderText="Long Name"

        SortExpression="Job_Title" UniqueName="Job_Title">

       </telerik:GridBoundColumn>

      </Columns>

      <EditFormSettings EditFormType="Template">

       <EditColumn FilterControlAltText="Filter EditCommandColumn1 column"

        UniqueName="EditCommandColumn1">

       </EditColumn>

      <FormTemplate>

 

   <table id="Table2" cellspacing="2" cellpadding="1" width="50%" border="1" rules="none"

    style="border-collapse: collapse;">

    <tr class="EditFormHeader">

    <td style="width:150px">

    <asp:Label ID="lb" Text="Short Name" runat="server"></asp:Label>                                                           

    </td>

    <td>

    <asp:TextBox ID="tb_job_title_ShortName" runat="server" Text='<%# Bind("job_title_ShortName") %>' TabIndex="2"></asp:TextBox>                                                           

    </td>

    </tr>

    <tr >

    <td >

    <asp:Label ID="Label2" Text="Long Name" runat="server"></asp:Label>                                                           

    </td>

    <td>

    <asp:TextBox ID="tb_job_title" runat="server" Text='<%# Bind("job_title") %>' TabIndex="2"></asp:TextBox>                                                           

    </td>

    </tr>

    <tr >

    <td >

    <asp:Label ID="Label1" Text="Department" runat="server"></asp:Label>                                                           

    </td>

    <td>

     <asp:CheckBoxList ID="CheckBoxList_Dept" runat="server"

      AutoPostBack="True"                                                       

      OnDataBound="CheckBoxList_Dept_DataBound" DataSourceID="LDS_Dept"

      DataTextField="Department" DataValueField="DeptID"  TabIndex="1"

      RepeatColumns="8" >

     </asp:CheckBoxList>

     <asp:LinqDataSource ID="LDS_Dept" runat="server"

     ContextTypeName="dcLRDBDataContext" EntityTypeName=""                                                                

     TableName="db_Departments">

     </asp:LinqDataSource>

    </td>

    </tr>

 

 

       <tr>

     <td align="right" colspan="2">

      <asp:Button ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'

       runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>' >

      </asp:Button>

      <asp:Button ID="btnDelete" Text="Delete" runat="server" CausesValidation="False"

       CommandName="Delete" OnClientClick="return conformbox();"   ></asp:Button>

      <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"

       CommandName="Cancel"></asp:Button>

     </td>

    </tr>

   </table>

  </FormTemplate>

 </EditFormSettings>

      <PagerStyle PageSizeControlType="RadComboBox" />

     </MasterTableView>

     <PagerStyle PageSizeControlType="RadComboBox" />

     <FilterMenu EnableImageSprites="False">

     </FilterMenu>

 

   </telerik:RadGrid>

                 <asp:LinqDataSource ID="LDS_JobTitle"

  runat="server" ContextTypeName="dcLRDBDataContext" EntityTypeName=""

  TableName="db_Dictionary_Job_Titles">

 </asp:LinqDataSource>
 
 
 
</asp:Content>


Code Behind:

Imports System
Imports System.IO
Imports Telerik.Web.UI
Imports System.Web.UI
Imports Telerik.Web.UI.AsyncUpload
Imports System.Runtime.Serialization.Json
Imports System.Web.Services
Imports System.Runtime.Serialization
Imports System.Collections.Generic
Imports System.Drawing
Partial Class Admin_Admin_dictionary_JobTitle
    Inherits System.Web.UI.Page
    Protected Sub RadGrid_JobTitle_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid_JobTitle.ItemCommand
        RadGrid_JobTitle.MasterTableView.ClearEditItems()
 
        If e.CommandName = RadGrid.InitInsertCommandName Then   'Click Add New Record button           
            Dim editColumn As GridEditCommandColumn = CType(RadGrid_JobTitle.MasterTableView.GetColumn("EditCommandColumn"), GridEditCommandColumn)
            editColumn.Visible = False
        ElseIf (e.CommandName = RadGrid.RebindGridCommandName AndAlso e.Item.OwnerTableView.IsItemInserted) Then
            e.Canceled = True
        Else
            Dim editColumn As GridEditCommandColumn = CType(RadGrid_JobTitle.MasterTableView.GetColumn("EditCommandColumn"), GridEditCommandColumn)
            If Not editColumn.Visible Then  'Click Cancel button (both Insert and Update mode)
                editColumn.Visible = True
            End If
 
            Dim txt_job_title_ShortName As TextBox = DirectCast(e.Item.FindControl("tb_job_title_ShortName"), TextBox)
            Dim txt_job_title As TextBox = DirectCast(e.Item.FindControl("tb_job_title"), TextBox)
 
            Dim dc As New dcLRDBDataContext
 
            If e.CommandName = "PerformInsert" Then
 
                Dim newRecord1 As New db_Dictionary_Job_Title
                dc.db_Dictionary_Job_Titles.InsertOnSubmit(newRecord1)
                newRecord1.Job_Title_shortname = txt_job_title_ShortName.Text
                newRecord1.Job_Title = txt_job_title.Text
 
                newRecord1.LastUpdateDate = DateTime.Now
                newRecord1.LastUpdateBy = HttpContext.Current.Session("UserID")
                dc.SubmitChanges()
 
                RadGrid_JobTitle.MasterTableView.ClearEditItems()
                RadGrid_JobTitle.DataBind()
 
            ElseIf e.CommandName = "Update" Then
                Dim lid As Integer = e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("ID")
 
                Dim rec = (From p In dc.db_Dictionary_Job_Titles Where p.ID = lid).FirstOrDefault
                If Not rec Is Nothing Then
                    rec.Job_Title_shortname = txt_job_title_ShortName.Text
                    rec.Job_Title = txt_job_title.Text
 
                    rec.LastUpdateBy = HttpContext.Current.Session("UserID")
                    rec.LastUpdateDate = DateTime.Now
                    dc.SubmitChanges()
                End If
 
                RadGrid_JobTitle.MasterTableView.ClearEditItems()
                RadGrid_JobTitle.DataBind()
            ElseIf e.CommandName = "Delete" Then
                Dim lid As Integer = e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("ID")
 
                Dim chk_rec = (From a In dc.db_Competency_Lists Where a.Job_Title_ID = lid).Count
                If chk_rec > 0 Then
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "MessageBox", "alert('Cannot delete because this dictionary had been used.');", True)
                Else
 
                    Dim chk_rec2 = (From a In dc.db_Employee_Details Where a.Job_Title_ID = lid).Count
                    If chk_rec2 > 0 Then
                        Page.ClientScript.RegisterStartupScript(Page.GetType(), "MessageBox", "alert('Cannot delete because this dictionary had been used.');", True)
                    Else
 
                        Dim rec2 = (From p In dc.db_Dictionary_Job_Titles Where p.ID = lid).FirstOrDefault
                        If Not IsNothing(rec2) Then
                            dc.db_Dictionary_Job_Titles.DeleteOnSubmit(rec2)
                            dc.SubmitChanges()
                        End If
 
                    End If
 
                End If
 
 
                RadGrid_JobTitle.MasterTableView.ClearEditItems()
                RadGrid_JobTitle.DataBind()
            End If
 
            dc.Dispose()
        End If
    End Sub
 
    Protected Sub CheckBoxList_Dept_DataBound(ByVal sender As Object, ByVal e As System.EventArgs)
 
    End Sub
End Class

Thanks






Shinu
Top achievements
Rank 2
 answered on 08 Oct 2013
3 answers
311 views
  The type or namespace name 'GridDataItem' could not be found (are you missing a using directive or an assembly reference?)  
what is the name of its class or namespace and how can i get it
thank you

Shinu
Top achievements
Rank 2
 answered on 08 Oct 2013
1 answer
80 views

      Hi,
          How shall I make the last item in combobox selected which is binded with sqldatasource.

   thanks
   Savyo
Shinu
Top achievements
Rank 2
 answered on 08 Oct 2013
1 answer
72 views
Hello,
How can i use telerik RibbonBar in SharePoint 2013?
I want to add RibbonBar on sharepoint page, 
Can i create ribbonBar in codeBehind file?

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server"
  <div class="Ribbon">
        <telerik:RadRibbonBar runat="server">
            <telerik:RadComboBox runat="server">....</telerik:RadComboBox>
        </telerik:RadRibbonBar>
    </div>
......
</asp:Content>
Dmitriy
Top achievements
Rank 1
 answered on 08 Oct 2013
1 answer
132 views
Hey Telerik,

We are looking for a solution to convert web form ASP.NET to MVC ASP.NET.
There are a lot telerik ASP.NET AJAX controls are used in our web form ASP.NET application like RadGrid\RadComboBox\RadAjaxManager\RadAjaxLoadingPanel\RadListBox......

Can we convert the telerik ASP.NET AJAX control to ASP.NET MVC control?

Thanks in Advance!
Jennifer
Jennifer
Top achievements
Rank 1
 answered on 07 Oct 2013
7 answers
143 views
I understand that when databinding to a web service you can't use the ItemTemplate. As a workaround, I set the Text property of the RadComboBoxItemData to the HTML I wanted to display in the drop down. This works, except that if I select an item in the drop down or use the up or down keys to navigate through the items, the HTML is displayed in the textbox. I am able to change the text when the selected item is changed, using a custom attribute of the item, but I'm not sure how to handle it for the up and down arrow selections.

Is there an event that fires when the text in the textbox is set? Or a way to override what is displayed in the textbox? Basically I need a way to set the DataTextField on the client side if that's possible.

We're really trying to avoid the old load on demand since this is on a master page. We don't want to have all those partial postbacks and the web service seems to be much faster.
Wojtek Victor
Top achievements
Rank 1
 answered on 07 Oct 2013
5 answers
60 views
I have a treeview which i have used extended template 
public class MyNodeTemplate : ITemplate
   {
       public string StrText { get; set; }
 
       public void InstantiateIn(Control container)
       {
           var txt = new TextBox();
           if (!String.IsNullOrEmpty(StrText))
           {
               txt.Width = new Unit(StrText.Length, UnitType.Em);
               txt.Text = StrText;
           }
           container.Controls.Add(txt);
       }
   }

I am binding it on some dropdownlist selected index change event

if (ddlTemplateSource.SelectedValue != "0")
            {
                TreeView1.Nodes.Clear();
 
 
                var lstSections =  SourceSectionBll.GetInstance.GetSourceSectionsByTemplateSourceId(Int32.Parse(ddlTemplateSource.SelectedValue));
 
 
                if (lstSections != null)
                {
                       if (obj.LstSimpleFieldSectionMappers != null &&  )
                        {
                            var tNodeChildSimpleFields = new RadTreeNode("Simple_fields_Control");
 
                            foreach (var objSimplefield in    obj.LstSimpleFields)
                            {
                                var tNodeChildSimpleFieldTextEntry = new RadTreeNode(objSimplefield.FieldName);
                                var tSimpleFiledLeafNode = new RadTreeNode {Expanded = true};
 
                                var objtemplate = new MyNodeTemplate {StrText = objSimplefield.FieldCode};
                                objtemplate.InstantiateIn(tSimpleFiledLeafNode);
                                tNodeChildSimpleFieldTextEntry.Nodes.Add(tSimpleFiledLeafNode);
                                tNodeChildSimpleFields.Nodes.Add(tNodeChildSimpleFieldTextEntry);
                            }
                            tNode.Nodes.Add(tNodeChildSimpleFields);
                        }                     
                        TreeView1.Nodes.Add(tNode);
                }               
            }

Problem is that treeview loses text inside the textbox when there is a button click event is triggerd
Anyway i can intact the data in the text box of MyNodeTemplate template?


kamii47
Top achievements
Rank 1
 answered on 07 Oct 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?