protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode))
{
//-------------Find TextBox In EditMode And Apply Css To Them------------
//GridEditableItem edititem = (GridEditableItem)e.Item;
//TextBox TxtEntityName = (TextBox)edititem["EntityName"].Controls[0];
//TextBox TxtEntityType = (TextBox)edititem["EntityType"].Controls[0];
//TextBox TxtEntityPath = (TextBox)edititem["EntityPath"].Controls[0];
//TextBox TxtDescription = (TextBox)edititem["Description"].Controls[0];
//TextBox TxtFileName = (TextBox)edititem["FileName"].Controls[0];
//TxtEntityName.CssClass = "riEditFormTextBox";
//TxtEntityType.CssClass = "riEditFormTextBox";
//TxtEntityPath.CssClass = "riEditFormTextBox";
//TxtDescription.CssClass = "riEditFormTextBox";
//TxtFileName.CssClass = "riEditFormTextBox";
}
//Validations For Textbox In Insert And Edit Mode
if ((e.Item is GridEditableItem && e.Item.IsInEditMode) || (e.Item is GridEditFormInsertItem && e.Item.OwnerTableView.IsItemInserted))
{
GridEditableItem item = e.Item as GridEditableItem;
GridTextBoxColumnEditor editor = (GridTextBoxColumnEditor)item.EditManager.GetColumnEditor("EntityName");
TableCell cell = (TableCell)editor.TextBoxControl.Parent;
RequiredFieldValidator validator = new RequiredFieldValidator();
validator.ControlToValidate = editor.TextBoxControl.ID;
validator.ErrorMessage = " * Required";
validator.Font.Bold = true;
cell.Controls.Add(validator);
}
ASPX:<
div
>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AllowMultiRowEdit
=
"True"
AutoGenerateHierarchy
=
"True"
CellSpacing
=
"0"
GridLines
=
"None"
Skin
=
"Windows7"
ondetailtabledatabind
=
"RadGrid1_DetailTableDataBind"
>
<
MasterTableView
DataKeyNames
=
"FullName,IsDirectory,ParentDirectory"
>
<
DetailTables
>
<
telerik:GridTableView
AutoGenerateColumns
=
"true"
DataKeyNames
=
"FullName,IsDirectory,ParentDirectory"
>
</
telerik:GridTableView
>
</
DetailTables
>
</
MasterTableView
>
</
telerik:RadGrid
>
</
div
>
public
partial
class
Default : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
List<FileWrapper> dirs =
new
DirectoryInfo(
"C://"
).GetDirectories().Select(obj =>
new
FileWrapper(obj,
true
)).ToList();
List<FileWrapper> files =
new
DirectoryInfo(
"C://"
).GetFiles().Select(obj =>
new
FileWrapper(obj,
true
)).ToList();
dirs.AddRange(files);
RadGrid1.DataSource = dirs;
RadGrid1.DataBind();
}
}
protected
void
RadGrid1_DetailTableDataBind(
object
sender, GridDetailTableDataBindEventArgs e)
{
GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;
bool
isDirectory =
bool
.Parse(dataItem.GetDataKeyValue(
"IsDirectory"
).ToString());
string
FullName = dataItem.GetDataKeyValue(
"FullName"
).ToString();
if
(isDirectory)
{
DirectoryInfo d =
new
DirectoryInfo(FullName);
List<FileWrapper> dirs = d.GetDirectories().Select(obj =>
new
FileWrapper(obj,
false
)).ToList();
List<FileWrapper> files = d.GetFiles().Select(obj =>
new
FileWrapper(obj,
false
)).ToList();
dirs.AddRange(files);
e.DetailTableView.DataSource = dirs;
}
}
}
public
class
FileWrapper
{
public
string
Name {
get
;
set
; }
public
string
FullName {
get
;
set
; }
public
bool
IsDirectory {
get
;
set
; }
public
DateTime CreationTime {
get
;
set
; }
public
string
ParentDirectory {
get
;
set
; }
public
List<FileWrapper> Children {
get
;
set
; }
public
FileWrapper(
object
o,
bool
isRoot)
{
if
(o
is
FileInfo)
{
FileInfo f = (FileInfo)o;
Name = f.Name;
FullName = f.FullName;
CreationTime = f.CreationTime;
IsDirectory =
false
;
if
(!isRoot)
{
ParentDirectory = f.Directory.FullName;
}
}
if
(o
is
DirectoryInfo)
{
DirectoryInfo d = (DirectoryInfo)o;
Name = d.Name;
FullName = d.FullName;
CreationTime = d.CreationTime;
IsDirectory =
true
;
if
(!isRoot)
{
ParentDirectory = d.Parent.FullName;
}
}
}
}
Have deployed a website to Azure websites and one of the pages has a SocialShare Send Email button. The popup send email form includes the Radcaptcha and by default has the "Get Audio Code" option.
When visiting the page I get a message "This web page wants to run the following add-on: 'Windows Media Player" It took me awhile to figure out why and than noticed that the popup form generated from SocialShare SendEmail has the Audio code option.
So when debugging the page (on the basis that a user chooses not to select the Allow) when proceeding to redirect the page I get error: "An unhandled exception of type 'System.NullReferenceException' occurred in System.Speech.dll"
(note I don't get this error when running local).
I am assuming this is being caused by the SocialShare Radcaptcha needing the add-on and errors out without it.
In any case I am happy to disable the AudioCode option as I have also done this on another Radcaptcha on the same page.
Is there a way to disable the Audiocode option on SocialShare Send Email button?
Thanks