protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
{
GridEditFormItem editItem = (GridEditFormItem)e.Item;
TextBox txtpwd = (TextBox)editItem["password"].Controls[0];
txtpwd.TextMode = TextBoxMode.Password;
if (!(e.Item.DataItem is GridInsertionObject))
{
txtpwd.Attributes.Add("value", txtpwd.Text);
}
}
}
<telerik:RadGrid GridLines=
"none"
ID=
"RadGrid1"
runat=
"server"
AllowMultiRowSelection=
"true"
AllowPaging=
"true"
AllowCustomPaging=
"true"
AllowSorting=
"true"
AllowAutomaticDeletes=
"true"
AutoGenerateColumns=
"true"
ShowStatusBar=
"false"
OnNeedDataSource=
"RadGrid1_NeedDataSource"
OnItemDataBound=
"RadGrid1_ItemDataBound"
OnItemCommand=
"RadGrid1_ItemCommand"
OnGroupsChanging=
"RadGrid1_GroupsChanging"
OnColumnCreated=
"RadGrid1_ColumnCreated"
OnDataBound=
"RadGrid1_DataBound"
OnSortCommand=
"RadGrid1_SortCommand"
OnItemCreated=
"RadGrid1_ItemCreated"
OnPreRender=
"RadGrid1_PreRender"
HorizontalAlign=
"NotSet"
Visible=
"false"
>
<ClientSettings AllowColumnHide=
"true"
AllowColumnsReorder=
"true"
AllowDragToGroup=
"true"
ReorderColumnsOnClient=
"true"
AllowKeyboardNavigation=
"true"
AllowRowsDragDrop=
"true"
AllowAutoScrollOnDragDrop=
"false"
EnablePostBackOnRowClick=
"false"
EnableRowHoverStyle=
"true"
>
<Resizing AllowColumnResize=
"true"
EnableRealTimeResize=
"true"
ResizeGridOnColumnResize=
"true"
/>
<Selecting AllowRowSelect=
"true"
/>
<Scrolling UseStaticHeaders=
"true"
SaveScrollPosition=
"true"
AllowScroll=
"true"
/>
<ClientEvents OnRowContextMenu=
"RadGrid1_RowContextMenu"
OnRowDropping=
"RadGrid1_RowDropping"
OnActiveRowChanged=
"RadGrid1_ActiveRowChanged"
OnRowSelected=
"RadGrid1_RowSelected"
OnRowDblClick=
"RadGrid1_RowDblClick"
OnKeyPress=
"RadGrid1_KeyPress"
OnCommand=
"RadGrid1_Command"
OnRowClick=
"rowClick"
OnRowMouseOver=
"RowMouseOver"
OnRowMouseOut=
"RowMouseOut"
OnMasterTableViewCreated=
"RadGrid1_MasterTableViewCreated"
/>
</ClientSettings>
<MasterTableView AllowMultiColumnSorting=
"false"
DataKeyNames=
"ID,Unread,FolderPath"
Width=
"100%"
ClientDataKeyNames=
"ID,Unread,FolderPath"
TableLayout=
"Fixed"
>
<PagerStyle Mode=
"NextPrevNumericAndAdvanced"
PageButtonCount=
"3"
AlwaysVisible=
"true"
/>
</MasterTableView>
</telerik:RadGrid>
function
RadGrid1_RowSelected(sender, eventArgs)
{
var
mst = sender.get_masterTableView();
var
index = eventArgs.get_gridDataItem().get_element().rowIndex;
}
After a lot of searching and hair pulling I have tracked down what seems to be a real deal breaker issue with a lot of rad controls especially radgrid, sorry for the vagueness of this post but it has been a long few days of deadlines :)
When using IE11 preview to view sites with enablepostbackonrowclick set on a radgrid - clicking on the rows does not work and rather raises a hidden away JavaScript error of: if($telerik.isIE){document.attachEvent("onmousedown",this._onDocumentClickDelegate);
The problem is particular to IE11 and it is not just related to it being in preview.
It is discussed at http://msdn.microsoft.com/en-us/library/ie/ms536343(v=vs.85).aspx
In this post it says:
Binds the specified function to an event, so that the function gets called whenever the event fires on the object.
So it seems that until there is an update to the core way rad controls handle mouse clicks they will not work even on IE final.
Dim
rowStateColumn
As
GridColumn = RadGrid1.MasterTableView.GetColumnSafe(
"Comp_ProjectCount"
)
rowStateColumn.CurrentFilterFunction = GridKnownFunction.GreaterThan
rowStateColumn.CurrentFilterValue = 0
RadGrid1.MasterTableView.FilterExpression =
"([Comp_ProjectCount] > 0 ')"
RadGrid1.Rebind()