window.onbeforeunload event fires. Is there a way to prevent this from happening?
Hi
I use this code for invisibling components in grid when I click on "Add New Record" but in running program the error "Object reference not set to an instance of an object." occured. how can I write this code that not cause this error?
public partial class Permissions : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
rwmSuccessPM.Visible =
false;
}
private void InitalizeGroupGrid()
{
IQueryable<CDS.Savin.DataAccess.tS000Group> groups = CDS.Savin.Logic.BusinessObjects.UI.Groups.RetriveAll();
this.grdGroups.DataSource = groups;
this.grdGroups.DataBind();
}
protected void grdGroups_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
IQueryable<CDS.Savin.DataAccess.tS000Group> groups = CDS.Savin.Logic.BusinessObjects.UI.Groups.RetriveAll();
this.grdGroups.DataSource = groups;
}
protected void grdGroups_EditCommand(object source, GridCommandEventArgs e)
{
GridDataItem item = (GridDataItem)e.Item;
rowindex = item.ItemIndex;
String id = item.GetDataKeyValue("GroupID").ToString();
Session[
"GroupID"] = id;
}
int rowindex = -1;
protected void grdGroups_ItemCommand(object source, GridCommandEventArgs e)
{
//GridEditFormInsertItem editItem = (GridEditFormInsertItem)grdGroups.MasterTableView.GetInsertItem();
// System.Web.UI.UserControl userControl = (System.Web.UI.UserControl)editItem.FindControl(GridEditFormItem.EditFormUserControlID);
//if (e.CommandName == RadGrid.EditCommandName)
//{
// GridDataItem item = (GridDataItem)e.Item;
// rowindex = item.ItemIndex;
//}
switch (e.CommandName)
{
case RadGrid.InitInsertCommandName:
{
System.Web.UI.
UserControl userControl = (System.Web.UI.UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
RadGrid Grid1 = (RadGrid)userControl.FindControl("PermissionGrid");
Grid1.Visible =
false;
CheckBox chkWrite = (CheckBox)userControl.FindControl("chkWrite");
chkWrite.Visible =
false;
CheckBox chkRead = (CheckBox)userControl.FindControl("chkRead");
chkRead.Visible =
false;
CheckBox chkModify = (CheckBox)userControl.FindControl("chkModify");
chkModify.Visible =
false;
CheckBox chkDelete = (CheckBox)userControl.FindControl("chkDelete");
chkDelete.Visible =
false;
break;
}
case "Delete":
{
}
protected void grdGroups_PreRender(object sender, EventArgs e)
{
if (grdGroups.MasterTableView.IsItemInserted)
{
GridEditFormInsertItem editItem = (GridEditFormInsertItem)grdGroups.MasterTableView.GetInsertItem();
System.Web.UI.
UserControl userControl = (System.Web.UI.UserControl)editItem.FindControl(GridEditFormItem.EditFormUserControlID);
TextBox txtbox = (TextBox)userControl.FindControl("txtGroupName");
RadGrid Grid1 = (RadGrid)userControl.FindControl("PermissionGrid");
}
if (rowindex > -1)
{
GridEditFormItem editItem = (GridEditFormItem)grdGroups.MasterTableView.GetItems(GridItemType.EditFormItem)[rowindex];
GridDataItem item = (GridDataItem)editItem.ParentItem;
System.Web.UI.
UserControl userControl = (System.Web.UI.UserControl)editItem.FindControl(GridEditFormItem.EditFormUserControlID);
TextBox txtbox = (TextBox)userControl.FindControl("txtGroupName");
rowindex = 1;
IQueryable<CDS.Savin.DataAccess.tS000Group> GroupName = CDS.Savin.Logic.BusinessObjects.UI.Groups.RetriveGroupName(int.Parse(item.Cells[3].Text));
txtbox.Text = GroupName.First().GroupName;
RadGrid Grid1 = (RadGrid)userControl.FindControl("PermissionGrid");
Grid1.DataSource = CDS.Savin.Logic.BusinessObjects.UI.
GroupPermissions.Retrieve(int.Parse(item.Cells[3].Text));
Grid1.DataBind();
rowindex = -1;
}
}
}
=
"True"
)<
tr
>
<
td
colspan
=
"2"
> <
b
> Supervisor Name </
b
></
td
>
<
td
colspan
=
"3"
>
<
asp:HiddenField
ID
=
"CRAFT_CODE_Textbox"
runat
=
"server"
value
=
"H"
/>
<
asp:HiddenField
ID
=
"SUPV_ID_TextBox"
runat
=
"server"
/>
<
br
/>
<
telerik:RadComboBox
ID
=
"wcOfficerName"
Runat
=
"server"
DataSourceID
=
"sdsOfficer"
DataTextField
=
"FULL_NAME"
DataValueField
=
"SUPV_ID"
EnableAutomaticLoadOnDemand
=
"False"
EnableItemCaching
=
"True"
EnableLoadOnDemand
=
"False"
EnableVirtualScrolling
=
"False"
Filter
=
"StartsWith"
ItemsPerRequest
=
"-1"
MarkFirstMatch
=
"False"
Width
=
"279px"
ShowMoreResultsBox
=
"False"
Skin
=
"Office2007"
LoadingMessage
=
"Loading Please Wait..."
EmptyMessage
=
"Please Select Supervisor"
>
</
telerik:RadComboBox
>
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"2"
> <
b
> Employee Name</
b
></
td
>
<
td
colspan
=
"3"
>
<
asp:HiddenField
ID
=
"EMPL_ID_TextBox"
runat
=
"server"
/>
<
br
/>
<
telerik:RadComboBox
ID
=
"wcEmployeeName"
Runat
=
"server"
DataSourceID
=
"sdsEmployees"
DataTextField
=
"FULL_NAME"
DataValueField
=
"PERSON_ID"
EnableAutomaticLoadOnDemand
=
"True"
EnableItemCaching
=
"True"
EnableLoadOnDemand
=
"False"
EnableVirtualScrolling
=
"False"
Filter
=
"StartsWith"
ItemsPerRequest
=
"-1"
MarkFirstMatch
=
"False"
Width
=
"279px"
ShowMoreResultsBox
=
"False"
Skin
=
"Office2007"
LoadingMessage
=
"Loading Please Wait..."
EmptyMessage
=
"Please Select Employee"
>
</
telerik:RadComboBox
>
<
br
/>
</
td
>
</
tr
>
=
"False"
then it errors out when I click the "submit" button.Me.wcEmployeeName.SelectedValue = dataset.Tables(0).Rows(0)(4)
Me.wcOfficerName.SelectedValue = dataset.Tables(0).Rows(0)(3)
I currently am using a Repeater (below) and I want to replace it with a RadGrid control. Can I create multi-row headers with a RadGrid control? I have other more complex header that span rows etc., are they supported? <asp:Repeater ID="Repeater1" runat="server" EnableViewState="False"> |
<HeaderTemplate> |
<p> |
<table width="95%" border="1" cellpadding="3" cellspacing="0"> |
<thead> |
<tr class="colTitle"> |
<th colspan="5" align="center"> |
<br/> |
<%# title%> |
<br/> |
<br/> |
For: <%# reportMonthHeader%> |
<br/> |
<br/> |
Process Date: <%# processDateHeader %> |
<br/> |
<br/> |
</th> |
</tr> |
<tr class="colTitle"> |
<th style="font-size: xx-small;" align="center" valign="bottom"> |
Contract ID |
</th> |
<th style="font-size: xx-small;" align="center" valign="bottom"> |
Contract Name |
</th> |
<th style="font-size: xx-small;" align="center" valign="bottom"> |
Total Number of Transactions Sent |
</th> |
<th style="font-size: xx-small;" align="center" valign="bottom"> |
Total Number of Transactions Received on Time |
</th> |
<th style="font-size: xx-small;" align="center" valign="bottom"> |
Percent of Transactions Received on Time |
</th> |
</tr> |
<tr class="colTitle"> |
<th style="font-size: xx-small;" align="center" valign="bottom"> |
A |
</th> |
<th style="font-size: xx-small;" align="center" valign="bottom"> |
B |
</th> |
<th style="font-size: xx-small;" align="center" valign="bottom"> |
C |
</th> |
<th style="font-size: xx-small;" align="center" valign="bottom"> |
D |
</th> |
<th style="font-size: xx-small;" align="center" valign="bottom"> |
E |
</th> |
</tr> |
</thead> |
<tbody> |
</HeaderTemplate> |
<ItemTemplate> |
<tr class="<%# Container.ItemIndex % 2 == 0 ? "tblalt" : "" %>"> |
<td width="15%" style="font-size: xx-small;" align="center" valign="middle"> |
<%# DataBinder.Eval(Container.DataItem, "ContractId")%> |
</td> |
<td width="40%" style="font-size: xx-small;" align="center" valign="middle"> |
<%# DataBinder.Eval(Container.DataItem, "ContractName")%> |
</td> |
<td width="15%" style="font-size: xx-small;" align="center" valign="middle"> |
<%# DataBinder.Eval(Container.DataItem, "TotEnrollSent")%> |
</td> |
<td width="15%" style="font-size: xx-small;" align="center" valign="middle"> |
<%# DataBinder.Eval(Container.DataItem, "TotRcvdOnTime")%> |
</td> |
<td width="15%" align="center" valign="middle" style='<%# (bool)(DataBinder.Eval(Container.DataItem, "HighlightPctRcvdOnTime"))?"font-size:xx-small;font-weight:bold;color:red;text-decoration:underline;":"font-size: xx-small;"%>'> |
<%# DataBinder.Eval(Container.DataItem, "PctRcvdOnTime")%> |
</td> |
</tr> |
</ItemTemplate> |
<FooterTemplate> |
</tbody> |
</table> |
</p> |
</FooterTemplate> |
</asp:Repeater> |