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;
}
<%@ 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">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
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;
}
}
}
|
<%@ 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>
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
<
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
>
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?