or
public void SelectRow<DataKeyType>(DataKeyType dataKeyValue) |
{ |
int index = 0; |
foreach (Telerik.Web.UI.DataKey key in this.MasterTableView.DataKeyValues) |
{ |
DataKeyType value = key.Values.OfType<DataKeyType>().FirstOrDefault(); |
this.MasterTableView.Items[index].Selected = (value.Equals(dataKeyValue)); |
index++; |
} |
} |
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
runat
=
"server"
ID
=
"RadScriptManager1"
/>
<
script
src
=
"scripts.js"
type
=
"text/javascript"
></
script
>
<
div
class
=
"qsf-demo-canvas qsf-demo-canvas-vertical"
style
=
"margin-top: 50px"
>
<
telerik:RadAsyncUpload
runat
=
"server"
ID
=
"AsyncUpload1"
ChunkSize
=
"1048576"
OnClientFilesUploaded
=
"fileUploaded"
OnFileUploaded
=
"AsyncUpload1_FileUploaded"
Localization-Select
=
"Add"
HttpHandlerUrl
=
"~/Handler.ashx"
/>
<
telerik:RadProgressArea
runat
=
"server"
ID
=
"RadProgressArea1"
/>
</
div
>
</
form
>
Protected
Overrides
Function
Process(
ByVal
file
As
UploadedFile,
ByVal
context
As
HttpContext,
ByVal
configuration
As
IAsyncUploadConfiguration,
ByVal
tempFileName
As
String
)
As
IAsyncUploadResult
' Call the base Process method to save the file to the temporary folder
' base.Process(file, context, configuration, tempFileName);
' Populate the default (base) result into an object of type SampleAsyncUploadResult
Dim
result
As
AsyncUploadResult = CreateDefaultUploadResult(Of AsyncUploadResult)(file)
' Populate any additional fields into the upload result.
' The upload result is available both on the client and on the server
'result.ImageID = InsertImage(file, userID)
Return
result
End
Function
Protected
Sub
Page_Load(sender
As
Object
, e
As
EventArgs)
' Populate the default (base) upload configuration into an object of type SampleAsyncUploadConfiguration
Dim
config
As
AsyncUploadConfiguration = AsyncUpload1.CreateDefaultUploadConfiguration(Of AsyncUploadConfiguration)()
AsyncUpload1.UploadConfiguration = config
End
Sub
Protected
Sub
AsyncUpload1_FileUploaded(sender
As
Object
, e
As
FileUploadedEventArgs)
Handles
AsyncUpload1.FileUploaded
Dim
result
As
AsyncUploadResult = TryCast(e.UploadResult, AsyncUploadResult)
Using stream
As
Stream = e.File.InputStream
Dim
imgData
As
Byte
() =
New
Byte
(stream.Length) {}
stream.Read(imgData, 0, imgData.Length)
Dim
ms
As
New
MemoryStream()
ms.Write(imgData, 0, imgData.Length)
Context.Cache.Insert(Session.SessionID +
"UploadedFile"
, ms,
Nothing
, DateTime.Now.AddMinutes(20), TimeSpan.Zero)
End
Using
End
Sub
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"ContentPlaceHolder1"
Runat
=
"Server"
>
<
div
>
<
script
type
=
"text/javascript"
>
function CloseAndRebind(args)
{
//alert("Record Updated!");
GetRadWindow().BrowserWindow.refreshGrid(args);
GetRadWindow().close();
}
function GetRadWindow() {
var oWindow = null;
if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz as well)
return oWindow;
}
function CancelEdit() {
GetRadWindow().close();
}
</
script
>
<%--<
telerik:RadAjaxPanel
ID
=
"RadAjaxPanel1"
runat
=
"server"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
>--%>
<
table
width
=
"98%"
style
=
"margin-left: auto; margin-right: auto; "
>
<
tr
>
<
th
class
=
"contenttableheader"
>Contacts</
th
>
</
tr
>
<
tr
>
<
td
class
=
"contenttableboxcontent"
>
<
table
style
=
"border-width: 0px; width: 100%; text-align: left; vertical-align: top;"
cellspacing
=
"2"
cellpadding
=
"5"
class
=
"Table1"
>
<
tr
><
td
class
=
"TitleBar"
colspan
=
"3"
>Contacts </
td
></
tr
>
<
tr
>
<
td
colspan
=
"3"
style
=
"text-align: center;"
><
asp:Label
ID
=
"_lblErrorMsg"
runat
=
"server"
Text
=
""
CssClass
=
"alert"
></
asp:Label
></
td
>
</
tr
>
<
tr
>
<
td
class
=
"LabelStyle"
>M/M</
td
>
<
td
class
=
"LabelStyle"
>First Name</
td
>
<
td
class
=
"LabelStyle"
>Last Name</
td
>
</
tr
>
<
tr
>
<
td
><
telerik:RadDropDownList
ID
=
"_mm"
runat
=
"server"
CssClass
=
"InputSelect"
DefaultMessage
=
"Select Title"
>
<
Items
>
<
telerik:DropDownListItem
Value
=
"Dr."
Text
=
"Dr."
/>
<
telerik:DropDownListItem
Value
=
"Mr."
Text
=
"Mr."
/>
<
telerik:DropDownListItem
Value
=
"Mrs."
Text
=
"Mrs."
/>
<
telerik:DropDownListItem
Value
=
"Ms."
Text
=
"Ms."
/>
<
telerik:DropDownListItem
Value
=
"Rev."
Text
=
"Rev."
/>
</
Items
>
</
telerik:RadDropDownList
>
<
asp:RequiredFieldValidator
runat
=
"server"
ID
=
"_mmValidate"
ControlToValidate
=
"_mm"
Text
=
"*"
ForeColor
=
"Red"
ErrorMessage="Mr./Mrs./Ms. is Required<br />" ValidationGroup="_validationProfile" EnableClientScript="true" Display="Dynamic" InitialValue="Select Title"></
asp:RequiredFieldValidator
>
</
td
>
<
td
><
telerik:RadTextBox
ID
=
"_firstName"
runat
=
"server"
></
telerik:RadTextBox
></
td
>
<
td
><
telerik:RadTextBox
ID
=
"_lastName"
runat
=
"server"
></
telerik:RadTextBox
></
td
>
</
tr
>
<
tr
>
<
td
class
=
"LabelStyle"
>Title</
td
>
<
td
class
=
"LabelStyle"
>Phone 1</
td
>
<
td
class
=
"LabelStyle"
>Phone 2</
td
>
</
tr
>
<
tr
>
<
td
><
telerik:RadTextBox
ID
=
"_title"
runat
=
"server"
></
telerik:RadTextBox
></
td
>
<
td
><
telerik:RadMaskedTextBox
ID
=
"_Phone1"
runat
=
"server"
Mask
=
"(###) ###-####"
ValidationGroup
=
"Group1"
></
telerik:RadMaskedTextBox
>
<%-- <
asp:RequiredFieldValidator
Display
=
"Dynamic"
ID
=
"MaskedTextBoxRequiredFieldValidator"
runat
=
"server"
ErrorMessage
=
"Please, enter a phone number."
ControlToValidate
=
"_Phone1"
></
asp:RequiredFieldValidator
>--%>
<
asp:RegularExpressionValidator
Display
=
"Dynamic"
ID
=
"MaskedTextBoxRegularExpressionValidator"
runat
=
"server"
ErrorMessage
=
"Format is (###) ###-####"
ControlToValidate
=
"_Phone1"
ValidationExpression
=
"\(\d{3}\) \d{3}-\d{4}"
EnableClientScript
=
"true"
ValidationGroup
=
"_validationProfile"
></
asp:RegularExpressionValidator
> ext. <
telerik:RadTextBox
ID
=
"_phone1Ext"
runat
=
"server"
Width
=
"75"
/>
</
td
>
<
td
><
telerik:RadMaskedTextBox
ID
=
"_phone2"
runat
=
"server"
Mask
=
"(###) ###-####"
ValidationGroup
=
"Group1"
></
telerik:RadMaskedTextBox
>
<%-- <
asp:RequiredFieldValidator
Display
=
"Dynamic"
ID
=
"RequiredFieldValidator1"
runat
=
"server"
ErrorMessage
=
"Please, enter a phone number."
ControlToValidate
=
"_Phone2"
></
asp:RequiredFieldValidator
>--%>
<
asp:RegularExpressionValidator
Display
=
"Dynamic"
ID
=
"RegularExpressionValidator1"
runat
=
"server"
ErrorMessage
=
"Format is (###) ###-####"
ControlToValidate
=
"_Phone2"
ValidationExpression
=
"\(\d{3}\) \d{3}-\d{4}"
EnableClientScript
=
"true"
ValidationGroup
=
"_validationProfile"
></
asp:RegularExpressionValidator
> ext. <
telerik:RadTextBox
ID
=
"_phone2Ext"
runat
=
"server"
Width
=
"75"
/>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"LabelStyle"
>Fax</
td
>
<
td
class
=
"LabelStyle"
>Contact Email</
td
>
</
tr
>
<
tr
>
<
td
><
telerik:RadMaskedTextBox
ID
=
"_Fax"
runat
=
"server"
Mask
=
"(###) ###-####"
ValidationGroup
=
"Group1"
></
telerik:RadMaskedTextBox
>
<
asp:RegularExpressionValidator
Display
=
"Dynamic"
ID
=
"RegularExpressionValidator2"
runat
=
"server"
ErrorMessage
=
"Format is (###) ###-####"
ControlToValidate
=
"_Fax"
ValidationExpression
=
"\(\d{3}\) \d{3}-\d{4}"
EnableClientScript
=
"true"
></
asp:RegularExpressionValidator
></
td
>
<
td
><
telerik:RadTextBox
ID
=
"_email"
runat
=
"server"
></
telerik:RadTextBox
>
<
asp:RegularExpressionValidator
ID
=
"emailValidator"
runat
=
"server"
Display
=
"Dynamic"
ErrorMessage
=
"Please, enter valid e-mail address."
ValidationExpression
=
"^[\w\.\-]+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]{1,})*(\.[a-zA-Z]{2,3}){1,2}$"
ControlToValidate
=
"_email"
EnableClientScript
=
"true"
ValidationGroup
=
"_validationProfile"
>
</
asp:RegularExpressionValidator
>
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"3"
style
=
"text-align: right;"
>
<
telerik:RadButton
ID
=
"_btnCancel"
runat
=
"server"
Text
=
"Cancel"
></
telerik:RadButton
>
<
telerik:RadButton
ID
=
"_btnSave"
runat
=
"server"
Text
=
"Save"
></
telerik:RadButton
>
</
td
>
</
tr
>
</
table
>
</
td
>
</
tr
>
</
table
>
<
asp:ValidationSummary
ID
=
"ValidationSummary1"
runat
=
"server"
ValidationGroup
=
"_validationProfile"
ShowMessageBox
=
"true"
ShowSummary
=
"true"
/>
<%-- </
telerik:RadAjaxPanel
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
></
telerik:RadAjaxLoadingPanel
>--%>
</
div
>
</
asp:Content
>