protected void grd_ItemDataBound(object sender, GridItemEventArgs e){ if (e.Item.OwnerTableView.Name == "ChildTable" && e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; string szID = item.GetDataKeyValue("ID").ToString(); string szName = item.GetDataKeyValue("NAME").ToString(); HyperLink hLink = (HyperLink)item.FindControl("HyperLink1"); hLink.Text = szName; hLink.Attributes.Add("onclick", "return onDocClick('" + item.OwnerTableView.ParentItem.ItemIndex + "', '" + item.ItemIndex + "');"); } }
Javascript
function onDocClick(parentindex, childindex)
{
// here How do i select/check Corresponding Parent Row and Child Row?
}
I have created Telerik Grid like this and item Bound Function also shown like as follows:
Please tell me if I resized the columns then how will I get the width of column present in RadGrid.Please find that telerik Auto Generated Column is set to true.
"
Namespace="Microsoft.SharePoint.WebControls" %>
<%@ Register Assembly="Telerik.Web.UI, Version=2010.2.826.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Table runat="server">
<asp:TableRow>
<asp:TableCell>
<telerik:RadGrid ID="gridForPreNewEdit2" AllowPaging="true" ShowFooter="false" runat="server" AutoGenerateColumns="true" GridLines="Both">
</telerik:RadGrid>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
void grdViewForPreview_ItemDataBound(object sender, GridItemEventArgs e)
{
try
{
if (e.Item is GridDataItem)
{
GridDataItem item = e.Item as GridDataItem;
SPWeb web = SPContext.Current.Web;
SPList list = web.Lists[new Guid(ddlSrcList.SelectedValue)];
SPListItem itemCol = list.Items.Add();
var contex = SPContext.GetContext(this.Context, 0, list.ID, list.ParentWeb);
foreach (GridColumn column in item.OwnerTableView.RenderColumns)
{
if (column.HeaderText == "Delete")
{
ImageButton btnDeleteFor = new ImageButton();
btnDeleteFor.ID = column.UniqueName;
btnDeleteFor.Enabled = false;
item[column.HeaderText].Controls.Clear();
item[column.HeaderText].Controls.Add(btnDeleteFor);
}
else
{
foreach (ListItem lstItem in lbDisplayedCols.Items)
{
if (lstItem.Text.ToLower().Trim() == column.HeaderText.ToLower().Trim())
{
SPField listField = list.Fields[column.HeaderText];
if (listField.Type != SPFieldType.DateTime && listField.Type != SPFieldType.User)
{
Panel pnlForBFC = new Panel();
pnlForBFC.ID = "Field2_" + listField.InternalName;
BaseFieldControl bfc = listField.FieldRenderingControl;
bfc.ID = "Field_" + listField.InternalName;
bfc.ControlMode = SPControlMode.New;
bfc.EnableViewState = true;
bfc.RenderContext = contex;
bfc.ItemContext = contex;
bfc.IsValid = true;
bfc.Visible = true;
pnlForBFC.Controls.Add(bfc);
pnlForBFC.Enabled = false;
item[column.HeaderText].Controls.Clear();
item[column.HeaderText].Controls.Add(pnlForBFC);
}
else if (listField.Type == SPFieldType.User)
{
PeopleEditor peopleEditor = new PeopleEditor();
item[column.HeaderText].Controls.Clear();
item[column.HeaderText].Controls.Add(peopleEditor);
}
else if (listField.Type == SPFieldType.DateTime)
{
DateTimeControl dtControl = new DateTimeControl();
dtControl.ID = "Field_" + listField.InternalName;
dtControl.Enabled = false;
item[column.HeaderText].Controls.Clear();
item[column.HeaderText].Controls.Add(dtControl);
}
 
}
}
}
}
}
else if (e.Item is GridFooterItem)
{
GridFooterItem itemForFooter = e.Item as GridFooterItem;
foreach (ListItem chosenListCol in lbDisplayedCols.Items)
{
if (ViewState[chosenListCol.Text] != null)
{
Label lblForFooter = new Label();
lblForFooter.ID = "Field_" + chosenListCol.Text;
lblForFooter.Text = "0";
lblForFooter.Width = Unit.Percentage(100);
lblForFooter.BorderColor = Color.Black;
lblForFooter.BorderStyle = BorderStyle.Solid;
lblForFooter.BorderWidth = 1;
itemForFooter[chosenListCol.Text].Controls.Clear();
itemForFooter[chosenListCol.Text].Controls.Add(lblForFooter);
}
}
}
<bks:BksGrid runat="server" ID="gridUsersCertifications" AutoGenerateColumns="false" OnItemCreated="gridUsersCertifications_OnItemCreated" OnItemDataBound="gridUsersCertifications_OnItemDataBound" OnPreRender="gridUsersCertifications_PreRender" ShowGroupPanel="true" OnNeedDataSource="gridUsersCertifications_OnNeedDataSource" ExtraHeight="55" AllowMultiRowSelection="true"> <MasterTableView AllowSorting="false" GroupLoadMode="Client" TableLayout="Fixed" DataKeyNames="UserCertificationID,BE_OriginatedIN,AcquiringStatusID" ClientDataKeyNames="UserCertificationID,BE_OriginatedIN,AcquiringStatusID" > <Columns> <telerik:GridClientSelectColumn UniqueName="SelectionColumn" ItemStyle-Width="35px" ></telerik:GridClientSelectColumn> <telerik:GridTemplateColumn Groupable="false" UniqueName="MenuColumn" ItemStyle-Width="30px"> <ItemTemplate> <img src="/Images/Edit.png" alt="" onclick="javascript:OpenMenu(event,'<%#Eval("UserCertificationID") %>','<%#Eval("AcquiredCertificationStatusID") %>','<%#Eval("AcquiringStatusID") %>','<%#Eval("AllowUpdateByUser") %>')"/> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridBoundColumn UniqueName="IDColumn" Display="false" DataField="UserCertificationID"></telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="UserIDColumn" DataField="UserID" Display="false"></telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="UserNameColumn" DataField="UserName" HeaderText="CERTIFICATION_USER_NAME"></telerik:GridBoundColumn> <telerik:GridBoundColumn Groupable="false" UniqueName="OUIDColumn" DataField="BE_OriginatedIN" Display="false"></telerik:GridBoundColumn> <telerik:GridTemplateColumn UniqueName="OUNameColumn" HeaderText="CERTIFICATION_OU" SortExpression="ParentName" GroupByExpression="ParentName Group By ParentName" > <ItemTemplate> <span class="spanFullPath"> <bks:BksLabel runat="server" ID="lblOuName" Text='<%#Eval("ParentName") %>'></bks:BksLabel> </span> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridBoundColumn Groupable="false" UniqueName="CertificationIDColumn" DataField="CertificationID" Display="false"></telerik:GridBoundColumn> <telerik:GridBoundColumn Groupable="false" UniqueName="MDTypeName" DataField="MDTypeName" HeaderText="CERTIFICATION_TYPE_NAME" ></telerik:GridBoundColumn> <telerik:GridBoundColumn Groupable="false" UniqueName="MDTypeID" DataField="MDTypeID" Display="false" ></telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="CertificationNameColumn" DataField="CertificationName" HeaderText="CERTIFICATION_NAME"></telerik:GridBoundColumn> <telerik:GridTemplateColumn UniqueName="StatusColumn" HeaderText="CERTIFICATION_STATUS" SortExpression="CertificationStatus" GroupByExpression="CertificationStatus Group By CertificationStatus"> <ItemTemplate> <span class="spanStatus"><img runat="server" id="imgStatus" alt="" src="" /></span> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridBoundColumn Groupable="false" UniqueName="CalculatedExpirationDateColumn" DataField="CalculatedExpirationDateFormat" HeaderText="CALCULATED_CERTIFICATION_EXPIRATION_DATE"></telerik:GridBoundColumn> <telerik:GridBoundColumn Groupable="false" UniqueName="OriginalExpirationDateColumn" DataField="OriginalExpirationDateFormat" HeaderText="ORIGINAL_CERTIFICATION_EXPIRATION_DATE"></telerik:GridBoundColumn> <telerik:GridBoundColumn Groupable="false" UniqueName="PlannedStartDateColumn" DataField="PlannedStartDateFormat" HeaderText="CERTIFICATION_PLANNED_START_DATE"></telerik:GridBoundColumn> <telerik:GridBoundColumn Groupable="false" UniqueName="PlannedAcquiringDateColumn" DataField="PlannedAcquiringDateFormat" HeaderText="CERTIFICATION_PLANNED_ACQUIRING_DATE"></telerik:GridBoundColumn> <telerik:GridTemplateColumn Groupable="false" UniqueName="acquiringStatusColumn" HeaderText="CERTIFICATION_ACQUIRING_STATUS" > <ItemTemplate> <span class="spanApprovalProcess"> <bks:BksLabel runat="server" ID="lblacquiringStatus" Text='<%#Eval("AcquiringStatus") %>'></bks:BksLabel> </span> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridBoundColumn Groupable="false" UniqueName="AcquiringMethodColumn" DataField="acquiringMethod" HeaderText="CERTIFICATION_ACQUIRING_RENEWAL_METHOD"></telerik:GridBoundColumn> <telerik:GridBoundColumn Groupable="false" UniqueName="InitialAcquirementDateColumn" DataField="InitialAcquirementDateFormat" HeaderText="CERTIFICATION_INITIAL_ACQUIREMENT_DATE"></telerik:GridBoundColumn> <telerik:GridTemplateColumn UniqueName="PendingUserApprovalColumn" Visible="false" HeaderText="CERTIFICATION_PENDING_FOR_USER_APPROVAL" > <ItemTemplate> <img runat="server" id="imgPendingUserApproval" alt="" src="/Certifications/Images/PendingApproval.png" /> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> <ClientSettings AllowGroupExpandCollapse="True" AllowDragToGroup="True" > <ClientEvents OnRowMouseOver="GridRowMouseOver" OnRowSelecting="GridUsersCertifications_OnRowSelecting" /> </ClientSettings> <GroupingSettings ShowUnGroupButton="true" /> <CommandButtons> <bks:BksButton ID="btnUpdateCertification" runat="server" Text="UPDATE_CERTIFICATIONS" OnClientClick="UpdateMultiCertifications()" /> </CommandButtons></bks:BksGrid>
I have a production application that users intermittently report getting a SYS not defined error on, and the radEditor fails to paint. I know there are various reasons for getting this error, but most of them are all setup related and would not apply for an intermittent occurrence. Any hints on how to track this down? It is not related to the user’s computer because everything is fine most of the time for the users who have reported this issue.

I was wondering if someone could explain to me how to get the datakeyvalue of a selected row on the server side and outside of a radgrid event.
For instance say I have a radgrid and it has a row that has been selected. When someone clicks a button (called btnTest for instance) that is somewhere else on the page, how do I go about getting the datakeyvalue of the selected row in btnTest’s click event.