child grid SelectionChanged event does not fire in DevExpress - c#

I have 2 ASPxGridView controls
- gvPatient and
- gvOrder
gvOrder is placed inside detail row template of gvPatient.
the issue i am faciing is i have to get the values of rows of gvOrder(child) on focus row changed or selection changed. I have code for these events but these events do not fire on selection changed of rows and focus changed of child grid . Strange this- here these child grid events fire on gvPatient(parent) row selection and focus changed.
code:
<%# Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Main.master" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content" ContentPlaceHolderID="MainContent" runat="server">
<table width="100%" border="0" cellpadding="2" cellspacing="2">
<tr>
<td>
</td>
</tr>
<tr>
<td style="height:300px;" valign="top">
<dx:ASPxGridView ID="gvPatient" runat="server" AutoGenerateColumns="false" DataSourceID="SqlDataSourceMaster"
Width="100%" Font-Size="11px" KeyFieldName="PAT_NUMBER" >
<Columns>
<dx:GridViewDataTextColumn Caption="PAT_NUMBER" FieldName="PAT_NUMBER" Visible="false">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn Caption="" FieldName="PATIENT_ID" Visible="false">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn Caption="Patient" FieldName="FULL_NAME" >
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn Caption="MRN" FieldName="MRN" >
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn Caption="Nursing Unit" FieldName="NURSING_UNIT">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn Caption="Room" FieldName="ROOM_BED" >
</dx:GridViewDataTextColumn>
</Columns>
<Templates>
<DetailRow>
<div style="padding:5px;">
<div>
<dx:ASPxGridView ID="gvOrder" runat="server" KeyFieldName="ORDER_KEY" DataSourceID="SqlDataSourceDetail"
Width="100%" AutoGenerateColumns="false"
nbeforeperformdataselect="gvOrder_BeforePerformDataSelect"
OnSelectionChanged="gvOrder_SelectionChanged"
onfocusedrowchanged="gvOrder_FocusedRowChanged"
ondetailrowexpandedchanged="gvOrder_DetailRowExpandedChanged">
<Columns>
<dx:GridViewDataTextColumn Caption="ORDER KEY" FieldName="ORDER_KEY" Visible="false">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn Caption="PAT_NUMBER" FieldName="PAT_NUMBER" Visible="false">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn Caption="Rx Edit" FieldName="RX" >
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn Caption="Reason Code" FieldName="REASON_CODE" >
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn Caption="Note" FieldName="NOTE">
</dx:GridViewDataTextColumn>
</Columns>
<Settings ShowFooter="True" />
<SettingsBehavior AllowFocusedRow="true" AllowSelectByRowClick="true" />
</dx:ASPxGridView>
</div>
<div style="padding-top:5px; padding-left:5px;">
<table cellpadding="2" cellspacing="2" border="0" width="100%">
<tr>
<td rowspan="3">
<dx:ASPxRoundPanel ID="ASPxRoundPanel2" runat="server" Width="500px" BackColor="White"
HeaderText="PLEASE FOLLOW FEDERAL AND STATE GUIDELINES TO ORDER THIS CONTROLLED SUBSTANCE" >
<PanelCollection>
<dx:PanelContent>
<table border="0" cellpadding="2" cellspacing="2" width="100%">
<tr>
<td align="left">
<dx:ASPxLabel ID="ASPxLabel11" runat="server" Text="Start">
</dx:ASPxLabel>
<b><dx:ASPxLabel ID="ASPxLabel12" runat="server" Text="04-04-13" Font-Bold="true" >
</dx:ASPxLabel></b>
</td>
<td align="right">
<dx:ASPxLabel ID="ASPxLabel13" runat="server" Text="Active" Font-Bold="true" >
</dx:ASPxLabel>
</td>
</tr>
<tr>
<td colspan="2">
<dx:ASPxLabel ID="ASPxLabel14" runat="server" Text="Initial">
</dx:ASPxLabel>
<b><dx:ASPxLabel ID="ASPxLabel15" runat="server" Text="04-04-13" Font-Bold="true" >
</dx:ASPxLabel></b>
</td>
</tr>
<tr>
<td colspan="2">
<dx:ASPxLabel ID="ASPxLabel16" runat="server" Text="Time Stamp">
</dx:ASPxLabel>
<b><dx:ASPxLabel ID="ASPxLabel17" runat="server" Text="04-04-13 02:53" Font-Bold="true" >
</dx:ASPxLabel></b>
</td>
</tr>
<tr>
<td colspan="2">
<dx:ASPxLabel ID="ASPxLabel18" runat="server" Text="OXYCODONE HCL IR 5MG TABLET (OXYCODONE HCL IR 5MB TABLET)" ></dx:ASPxLabel>
<br /><dx:ASPxLabel ID="ASPxLabel19" runat="server" Text="ONE TAB(5 mg) by mouth every 4 hours as neded pain tele order by bhardwaj, rakesh" ></dx:ASPxLabel>
<br /><dx:ASPxLabel ID="ASPxLabel20" runat="server" Text="noted on 04-04-13 2:53pm by erma entena, md" ></dx:ASPxLabel>
</td>
</tr>
</table>
</dx:PanelContent>
</PanelCollection>
</dx:ASPxRoundPanel>
</td>
<td>
<dx:ASPxLabel ID="ASPxLabel1" runat="server" Text="Action:"></dx:ASPxLabel>
</td>
<td>
<dx:ASPxComboBox ID="ASPxComboBox1" runat="server" ValueType="System.String" Width="300px" >
<Items>
<dx:ListEditItem Text="" />
<dx:ListEditItem Text="Continue" />
<dx:ListEditItem Text="Discontinue" />
<dx:ListEditItem Text="Substitute" />
<dx:ListEditItem Text="Wean/Taper" />
</Items>
</dx:ASPxComboBox>
</td>
</tr>
<tr>
<td>
<dx:ASPxLabel ID="ASPxLabel3" runat="server" Text="Reason:"></dx:ASPxLabel>
</td>
<td>
<dx:ASPxComboBox ID="cbReason" runat="server" ValueType="System.String" Width="300px" >
<Items>
<dx:ListEditItem Text="" />
<dx:ListEditItem Text="Duplicate Drugs" />
<dx:ListEditItem Text="Ineffective drug therapy" />
<dx:ListEditItem Text="Non-compliance with drug therapy" />
<dx:ListEditItem Text="Significant side effects" />
<dx:ListEditItem Text="Significant drug interactions" />
<dx:ListEditItem Text="Behavioral Changes" />
<dx:ListEditItem Text="POLST/MOLST" />
<dx:ListEditItem Text="Refusing Medication" />
</Items>
</dx:ASPxComboBox>
</td>
</tr>
<tr>
<td>
<dx:ASPxLabel ID="ASPxLabel2" runat="server" Text="Comment:"></dx:ASPxLabel>
</td>
<td>
<dx:ASPxMemo ID="tbNote" runat="server" Height="70px" Width="300px" ></dx:ASPxMemo>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
<dx:ASPxButton ID="btnSave" runat="server" Text="Save" onclick="btnSave_Click"></dx:ASPxButton>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
<dx:ASPxLabel ID="lblMsg" runat="server" Text="" ForeColor="Red"></dx:ASPxLabel>
</td>
</tr>
</table>
</div>
</div>
</DetailRow>
</Templates>
<SettingsDetail ShowDetailRow="true" AllowOnlyOneMasterRowExpanded="true" />
<SettingsBehavior AllowFocusedRow="true" AllowSelectByRowClick="true" ProcessSelectionChangedOnServer="True" />
</dx:ASPxGridView>
</td>
</tr>

You need to set properties SettingsBehavior.ProcessSelectionChangedOnServer and
SettingsBehavior.ProcessFocusedRowChangedOnServer to true.
From docs: "If the ProcessSelectionChangedOnServer property is set to false, the ASPxClientGridView.SelectionChanged event is handled on the client side without a postback to the server".

Related

How to make first 2 tabs of radtabstrip mandatory to be filled out?

I have an ASP.NET project with telerik embedded.
The telerik control I have is RadTabStrip.
The current task is The customer wants the first 2 tabs "Employee" and "general info" to be fill out first before they are able to fill out the other tabs.
Not sure how to implement this. Here is a sample
<telerik:RadTabStrip ID="RadTabStrip1" runat="server" SelectedIndex="0" MultiPageID="RadMultiPage1"
Skin="Telerik" CausesValidation="false">
<Tabs>
<telerik:RadTab runat="server" Selected="True">
<TabTemplate>
<asp:Label ID="Label29" runat="server" Text="<%$ Resources:strings, sample_generalinformation %>" />
<img id="generalInfoErrorIndicator" src="../Images/alert-small.gif" alt="" style="display: none;" />
</TabTemplate>
</telerik:RadTab>
<telerik:RadTab runat="server">
Here is the tab code.
<!-- EMPLOYEE INFORMATION -->
<telerik:RadPageView ID="pvEmployeeInformation" runat="server">
<div id="employeeInfoDiv" runat="server">
<table border="0" cellpadding="3" cellspacing="2">
<tr>
<td colspan="2">
<h1>
<asp:Label ID="Label34" runat="server" Text="<%$ Resources:strings, observed_employee_information %>" /></h1>
</td>
</tr>
<tr>
<td style="text-align: right;">
<asp:Label ID="Label12" runat="server" Text="<%$ Resources:strings, employee_label %>"
Font-Bold="True" ForeColor="Navy" />
</td>
<td style="text-align: left;">
<ihamm:EmployeeSearch ID="employeeSearch" runat="server" OnClientEmployeeSelected="employeeSelected"
ClientValidationFunction="validateEmployee" ValidationGroup="employeeInfo" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<table border="0" cellpadding="3" cellspacing="2">
<tr>
<td>
<asp:CheckBox ID="areaSampleCheckBox" runat="server" Text="<%$ Resources:strings, labels_areasample %>"
ValidationGroup="employeeInfo" />
</td>
<td>
<asp:CheckBox ID="unknownEmployeeCheckBox" runat="server" Text="<%$ Resources:strings, labels_unknownemployee %>"
ValidationGroup="employeeInfo" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="text-align: right;">
<asp:Label ID="Label13" runat="server" Text="<%$ Resources:strings, job_label %>"
Font-Bold="True" ForeColor="Navy" />
</td>
<td style="text-align: left;">
<ihamm:JobSearch ID="jobSearch" runat="server" ValidationGroup="employeeInfo" ClientValidationFunction="validateJob"
OnClientJobSelected="jobSelected" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:CheckBox ID="unknownJobCheckBox" runat="server" Text="<%$ Resources:strings, labels_unknownjob %>" />
</td>
</tr>
<tr>
<td style="text-align: right;">
<asp:Label ID="Label14" runat="server" Text="<%$ Resources:strings, shift_label %>"
Font-Bold="True" ForeColor="Navy" />
</td>
<td style="text-align: left;">
<ihamm:NewShiftDropDown ID="shiftDropDown" runat="server" ValidationGroup="employeeInfo" />
</td>
</tr>
<tr>
<td style="text-align: right;">
<asp:Label ID="Label15" runat="server" Text="<%$ Resources:strings, shiftlength_label %>"
Font-Bold="True" ForeColor="Navy" />
</td>
<td style="text-align: left;">
<ihamm:NewShiftLengthDropDown ID="shiftLengthDropDown" runat="server" ValidationGroup="employeeInfo" />
</td>
</tr>
<tr>
<td colspan="2">
<asp:ValidationSummary ID="employeeInformationValidationSummary" runat="server" Font-Bold="True"
ForeColor="Red" HeaderText="<%$ Resources:strings, validationsummary_nextwizard_msg %>"
ValidationGroup="employeeInfo" />
</td>
</tr>
</table>
</div>
</telerik:RadPageView>
And another
<!-- GENERAL INFORMATION -->
<telerik:RadPageView ID="pvGeneralInformation" runat="server">
<div id="generalInfoDiv" runat="server">
<table border="0" cellpadding="3" cellspacing="2">
<tr>
<td colspan="4">
<h1>
<asp:Label ID="Label16" runat="server" Text="<%$ Resources:strings, general_information %>" /></h1>
</td>
</tr>
<tr valign="top">
<td style="text-align: right;">
<asp:Label ID="Label1" runat="server" Text="<%$ Resources:strings, facility_label %>"
Font-Bold="True" ForeColor="Navy" />
</td>
<td style="text-align: left;">
<ihamm:FacilitySearch ID="facilitySearch" runat="server" ValidationGroup="generalInfo"
OnClientFacilitySelected="facilitySelected" OnClientFacilityCleared="facilityCleared"
AutoPostBack="true" />
</td>
<td style="text-align: right; padding-left: 10px;" valign="top">
<asp:Label ID="Label7" runat="server" Text="<%$ Resources:strings, samplelength_label %>"
Font-Bold="True" ForeColor="Navy" />
</td>
<td style="text-align: left;">
<ihamm:NewSampleLengthDropDown ID="sampleLengthDropDown" runat="server" ValidationGroup="generalInfo" />
</td>
</tr>
<tr valign="top">
<td style="text-align: right; padding-left: 10px;">
<asp:Label ID="Label2" runat="server" Text="<%$ Resources:strings, sampledate_label %>"
Font-Bold="True" ForeColor="Navy" />
</td>
<td style="text-align: left;">
<ihamm:NewDateEntry ID="sampleDate" runat="server" ValidationGroup="generalInfo"
ValidateDateNotInFuture="true" />
</td>
<td style="text-align: right; padding-left: 10px;" valign="top">
<asp:Label ID="Label8" runat="server" Text="<%$ Resources:strings, samplemethod_label %>"
Font-Bold="True" ForeColor="Navy" />
</td>
<td style="text-align: left;">
<ihamm:SampleMethodSearch ID="sampleMethodSearch" runat="server" ValidationGroup="generalInfo"
OnClientSampleMethodSelected="sampleMethodSelected" />
</td>
</tr>
<tr valign="top">
<td style="text-align: right;">
<asp:Label ID="Label3" runat="server" Text="<%$ Resources:strings, sampletype_label %>"
Font-Bold="True" ForeColor="Navy" />
</td>
<td style="text-align: left;">
<ihamm:NewSampleTypeDropDown ID="sampleTypeDropDown" runat="server" ValidationGroup="generalInfo"
FormDesignator="PassiveBadge" />
</td>
<td style="text-align: right; padding-left: 10px;" valign="top">
<asp:Label ID="Label69" runat="server" Text="<%$ Resources:strings, samplenumber_label %>"
Font-Bold="True" ForeColor="Navy" />
</td>
<td style="text-align: left;">
<telerik:RadTextBox ID="sampleNumberTextBox" runat="server" Skin="Telerik" Width="200px" /> <asp:Image
ID="sampleNumberInfoImage" runat="server" ImageUrl="~/Images/info.png" ToolTip="<%$ Resources:strings, samplenumber_info %>" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator19" runat="server"
ControlToValidate="sampleNumberTextBox" ErrorMessage="<%$ Resources:strings, validations_fieldlength_16 %>"
ToolTip="<%$ Resources:strings, validations_fieldlength_16 %>" ValidationExpression="<%$ AppSettings:Length16ValidationExpression %>"
ValidationGroup="generalInfo" />
</td>
</tr>
<tr valign="top">
<td style="text-align: right; padding-left: 10px;" valign="top">
<asp:Label ID="Label4" runat="server" Text="<%$ Resources:strings, occupationalhealthlimit_label %>"
Font-Bold="True" ForeColor="Navy" />
</td>
<td style="text-align: left;">
<ihamm:OelSearch ID="oelSearch" runat="server" ValidationGroup="generalInfo" OnClientOelSelected="oelSelected" />
</td>
<td style="text-align: right; padding-left: 10px;" valign="top">
<asp:Label ID="Label10" runat="server" Text="<%$ Resources:strings, labsamplenumber_label %>"
Font-Bold="True" ForeColor="Navy" />
</td>
<td style="text-align: left;">
<telerik:RadTextBox ID="labSampleNumberTextBox" runat="server" Skin="Telerik" Width="175px" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="labSampleNumberTextBox"
ErrorMessage="<%$ Resources:strings, labsamplenumber_length %>" ToolTip="<%$ Resources:strings, labsamplenumber_length %>"
ValidationExpression="<%$ AppSettings:Length64ValidationExpression %>" ValidationGroup="generalInfo" />
</td>
</tr>
<tr valign="top">
<td style="text-align: right; padding-left: 10px;" valign="top">
<asp:Label ID="Label67" runat="server" Text="<%$ Resources:strings, exposuregroup_label %>"
Font-Bold="True" ForeColor="Navy" />
</td>
<td style="text-align: left;">
<ihamm:ExposureGroupSearch ID="exposureGroupSearch" runat="server" ValidationGroup="generalInfo" />
</td>
<td colspan="2" align="center">
<table border="0" cellpadding="3" cellspacing="2">
<tr>
<td style="text-align: right; padding-left: 10px;" valign="top">
<asp:Label ID="Label11" runat="server" Text="<%$ Resources:strings, stelsample_label %>"
Font-Bold="True" ForeColor="Navy" />
</td>
<td style="text-align: left;">
<asp:CheckBox ID="stelSampleCheckBox" runat="server" />
</td>
<td style="text-align: right; padding-left: 10px;" valign="top">
<asp:Label ID="Label68" runat="server" Text="<%$ Resources:strings, labels_ceiling %>"
Font-Bold="True" ForeColor="Navy" />
</td>
<td style="text-align: left;">
<asp:CheckBox ID="ceilingSampleCheckBox" runat="server" />
</td>
</tr>
</table>
</td>
</tr>
<tr valign="top">
<td style="text-align: right; padding-left: 10px;" valign="top">
<asp:Label ID="Label5" runat="server" Text="<%$ Resources:strings, collectinguser_label %>"
Font-Bold="True" ForeColor="Navy" />
</td>
<td style="text-align: left;">
<ihamm:AdminUserSearch ID="adminUserSearch" runat="server" ValidationGroup="generalInfo" />
</td>
<td style="text-align: right;">
<asp:Label ID="Label18" runat="server" Text="<%$ Resources:strings, samplingdevice_label %>"
Font-Bold="True" ForeColor="Navy" />
</td>
<td style="text-align: left;">
<ihamm:NewSamplingDeviceDropDown ID="samplingDeviceDropDown" runat="server" />
</td>
</tr>
<tr valign="top">
<td style="text-align: right; padding-left: 10px;" valign="top">
<asp:Label ID="Label6" runat="server" Text="<%$ Resources:strings, samplestrategy_label %>"
Font-Bold="True" ForeColor="Navy" />
</td>
<td style="text-align: left;">
<ihamm:NewSampleStrategyDropDown ID="sampleStrategyDropDown" runat="server" ValidationGroup="generalInfo" />
</td>
<td style="text-align: right;">
<asp:Label ID="Label19" runat="server" Text="<%$ Resources:strings, blanknumber_label %>"
Font-Bold="True" ForeColor="Navy" />
</td>
<td style="text-align: left;">
<telerik:RadTextBox ID="blankNumberTextBox" runat="server" Skin="Telerik" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="blankNumberTextBox"
ErrorMessage="<%$ Resources:strings, blanknumber_required %>" ToolTip="<%$ Resources:strings, blanknumber_required %>"
ValidationGroup="generalInfo" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="blankNumberTextBox"
ErrorMessage="<%$ Resources:strings, blanknumber_length %>" ToolTip="<%$ Resources:strings, blanknumber_length %>"
ValidationExpression="<%$ AppSettings:Length64ValidationExpression %>" ValidationGroup="generalInfo" />
</td>
</tr>
<tr valign="top">
<td colspan="4">
<asp:ValidationSummary ID="generalInformationValidationSummary" runat="server" Font-Bold="True"
ForeColor="Red" HeaderText="<%$ Resources:strings, validationsummary_nextwizard_msg %>"
ValidationGroup="generalInfo" />
</td>
</tr>
</table>
</div>
</telerik:RadPageView>
It is very difficult to give you a solution based on your own code because of all the custom references. However, the controls in the various tabs can be accessed directly from code behind. I made a test on a 3 tabs RadTabStrip playing on enabling tab2.
UPDATE
Something went wrong with the previous example. I had to use some Javascript to resolve the issue on the client side. I tested this code and it is working. Basically there are two textboxes on the first tab and a button that is disabled by default. The button gets enabled only if text is in both textboxes (I understood you have more than one control on the tab that needs to be filled-in so this is a good example). Then clicking the button you enable tab 2. You can rewrite the javascript to enable directly the tabs when your fields/controls on the first and second tab are satisfying the requirements.
In PAGE_LOAD set the tabs that should not be visible or enabled
protected void Page_Load(object sender, EventArgs e)
{
//RadTabStrip1.Tabs[2].Visible = false;
RadTabStrip1.Tabs[2].Enabled = false;
}
protected void Button1_Click(object sender, EventArgs e)
{
RadTabStrip1.Tabs[2].Enabled = true;
}
Here is the rest of the code with the script
<body>
<form id="form1" runat="server">
<script language="javascript" type="text/javascript">
//function to enable button if two textboxes contains text
function SetButtonStatus(sender, target) {
var first = document.getElementById('<%=TextBox1.ClientID %>');
var second = document.getElementById('<%=TextBox2.ClientID %>');
//Condition to check whether user enters text in two textboxes or not
if ((sender.value.length >= 1 && first.value.length >= 1) && (sender.value.length >= 1 && second.value.length >= 1))
document.getElementById(target).disabled = false;
else
document.getElementById(target).disabled = true;
}
</script>
<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
<div>
<telerik:RadTabStrip RenderMode="Lightweight" runat="server" ID="RadTabStrip1" MultiPageID="RadMultiPage1" SelectedIndex="0" Skin="Silk">
<Tabs>
<telerik:RadTab Text="I am Tab 0" Width="200px"></telerik:RadTab>
<telerik:RadTab Text="I am Tab 1" Width="200px"></telerik:RadTab>
<telerik:RadTab Text="I am Tab 2" Width="200px"></telerik:RadTab>
</Tabs>
</telerik:RadTabStrip>
<telerik:RadMultiPage runat="server" ID="RadMultiPage1" SelectedIndex="0" CssClass="outerMultiPage">
<telerik:RadPageView runat="server" ID="RadPageView1">
<telerik:RadTabStrip RenderMode="Lightweight" runat="server" ID="RadTabStrip2" MultiPageID="RadMultiPage2"
Orientation="VerticalLeft" Skin="Silk" Width="50px" Height="355px" SelectedIndex="0">
</telerik:RadTabStrip>
<telerik:RadMultiPage runat="server" ID="RadMultiPage2" SelectedIndex="0" CssClass="innerMultiPage">
<telerik:RadPageView runat="server" ID="PageView1">
<div>
<asp:TextBox ID="TextBox1" runat="server" onkeyup="SetButtonStatus(this,'btnButton')"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server" onkeyup="SetButtonStatus(this,'btnButton')"></asp:TextBox>
<asp:Button ID="btnButton" runat="server" Text="Button" Enabled="false" OnClick="Button1_Click" />
</div>
</telerik:RadPageView>
</telerik:RadMultiPage>
</telerik:RadPageView>
<telerik:RadPageView runat="server" ID="RadPageView2">
<div></div>
<div>
<p>Something</p>
</div>
</telerik:RadPageView>
<telerik:RadPageView runat="server" ID="RadPageView3">
<div>
<p>Again something</p>
</div>
</telerik:RadPageView>
</telerik:RadMultiPage>
</div>
</form>
</body>

RadGrid cannot show Edit Form, because of Exception in DataBinding

i got a problem.
I am following this demo to show a Edit Form on RadGrid. But i can't display the Edit Form when i click Edit button.
This is the code i am using:
<telerik:RadGrid ID="radGridTarget" GridLines="None" runat="server" AllowAutomaticDeletes="True"
AllowAutomaticInserts="True" PageSize="10" Width="500px"
OnItemDeleted="radGridTarget_ItemDeleted" OnItemInserted="radGridTarget_ItemInserted"
OnItemUpdated="radGridTarget_ItemUpdated" AllowAutomaticUpdates="True" AllowPaging="True"
AutoGenerateColumns="False"
onneeddatasource="radGridTarget_NeedDataSource"
onitemcommand="radGridTarget_ItemCommand" >
<MasterTableView CommandItemDisplay="Top" HorizontalAlign="NotSet" AutoGenerateColumns="False">
<NoRecordsTemplate>
<table width="100%" border="0" cellpadding="20" cellspacing="20">
<tr>
<td align="center">
<h2 style="color:Black">No Data Found.</h2>
</td>
</tr>
</table>
</NoRecordsTemplate>
<PagerStyle Mode="NumericPages"/>
<Columns>
<telerik:GridEditCommandColumn HeaderStyle-Width="10%"></telerik:GridEditCommandColumn>
<telerik:GridBoundColumn DataField="Sales" HeaderText="NIK Sales" Display="false"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Target" DefaultInsertValue="Target" HeaderStyle-Width="20%" UniqueName="Target" DataField="Target">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Amount" HeaderStyle-Width="20%" HeaderText="Target Amount" SortExpression="Amount" UniqueName="Amount">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Campaign" HeaderText="Campaign" UniqueName="Campaign" HeaderStyle-Width="20%"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="StartDate" HeaderText="StartDate" UniqueName="StartDate" HeaderStyle-Width="10%"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="EndDate" HeaderText="EndDate" UniqueName="EndDate" HeaderStyle-Width="10%"></telerik:GridBoundColumn>
<telerik:GridButtonColumn ConfirmText="Delete this target?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" HeaderText="Delete"
HeaderStyle-Width="10%" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
</telerik:GridButtonColumn>
</Columns>
<EditFormSettings EditFormType="Template">
<FormTemplate>
<table id="tableFormEdit" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none"
style="border-collapse: collapse;">
<tr class="EditFormHeader">
<td colspan="2">
<b>Target Details</b>
</td>
</tr>
<tr>
<td>
<table id="Table3" width="450px" border="0" class="module">
<tr>
<td>Target:
</td>
<td>
<telerik:RadDropDownList ID="radDropDownTargetList" EmptyMessage="Target" runat="server" SelectedItem='<%# Bind("Target") %>'
DataSource='<%# PopulateTargetList() %>' DataTextField="Desc" DataValueField="Value" Skin="MetroTouch" TabIndex="5" >
</telerik:RadDropDownList>
</td>
</tr>
<tr>
<td>Amount:
</td>
<td>
<telerik:RadNumericTextBox ID="radTextAmount" runat="server" EmptyMessage="Amount" Text='<%# Bind("Amount") %>' TabIndex="6"
Skin="MetroTouch" ShowButton="false" ShowSpinButtons="false">
<NumberFormat GroupSeparator="" DecimalDigits="0" />
</telerik:RadNumericTextBox>
</td>
</tr>
<tr>
<td>Campaign:
</td>
<td>
<telerik:RadDropDownList ID="radDropDownCampaignList" EmptyMessage="Campaign" runat="server" SelectedItem='<%# Bind("Campaign") %>'
DataTextField="Desc" DataValueField="Value" Skin="MetroTouch" TabIndex="7" >
</telerik:RadDropDownList>
</td>
</tr>
<tr>
<td>Start Date:
</td>
<td>
<telerik:RadDatePicker ID="radStartDate" runat="server" Culture="en-US" TabIndex="8" Skin="MetroTouch">
<Calendar ID="Calendar1" runat="server">
<SpecialDays>
<telerik:RadCalendarDay Repeatable="Today" ItemStyle-BackColor="Yellow">
</telerik:RadCalendarDay>
</SpecialDays>
</Calendar>
<DateInput DisplayDateFormat="d/M/yyyy" DateFormat="d/M/yyyy" LabelWidth="40%" TabIndex="6">
</DateInput>
</telerik:RadDatePicker>
</td>
</tr>
<tr>
<td>End Date:
</td>
<td>
<telerik:RadDatePicker ID="radEndDate" runat="server" Culture="en-US" TabIndex="9" Skin="MetroTouch">
<Calendar ID="Calendar2" runat="server">
<SpecialDays>
<telerik:RadCalendarDay Repeatable="Today" ItemStyle-BackColor="Yellow">
</telerik:RadCalendarDay>
</SpecialDays>
</Calendar>
<DateInput DisplayDateFormat="d/M/yyyy" DateFormat="d/M/yyyy" LabelWidth="40%" TabIndex="6">
</DateInput>
</telerik:RadDatePicker>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' TabIndex="10"></asp:Button>
<asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" TabIndex="11"
CommandName="Cancel"></asp:Button>
</td>
</tr>
</table>
</FormTemplate>
</EditFormSettings>
</MasterTableView>
<ClientSettings AllowKeyboardNavigation="true">
</ClientSettings>
</telerik:RadGrid>
and
protected void radGridTarget_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == RadGrid.InitInsertCommandName) //"Add new" button clicked
{
GridEditCommandColumn editColumn = (GridEditCommandColumn)radGridTarget.MasterTableView.GetColumn("EditCommandColumn");
editColumn.Visible = false;
}
else if (e.CommandName == RadGrid.RebindGridCommandName && e.Item.OwnerTableView.IsItemInserted)
{
e.Canceled = true;
}
else
{
GridEditCommandColumn editColumn = (GridEditCommandColumn)radGridTarget.MasterTableView.GetColumn("EditCommandColumn");
if (!editColumn.Visible)
editColumn.Visible = true;
}
}
Where part that i gone wrong?
the working part is "Add New Button" only. and when i click edit command, there's nothing to show.
UPDATE
I am trying to debug using IE, and i got something.
When i click edit, it says:
Sys.WebForms.PageRequestManagerServerErrorException: Specified cast is
not valid.
Question:
1. Why the errors happen?
How to solve this problem?
Please help me. Thank you in advance

TextBox in the RadGrid control doesn't make partial postback and fills the other controls

I have a TextBox (named as txt_lect_in) in RadGrid and I handled the TextBox changed event so it fills other textboxes (gv_txt_name,gv_txt_mobile,gv_txt_address,gv_txt_email) in the same grid.
The problem is:
The TextBox (txt_lect_in) doesn't fills the other textboxes, I know the reason but I don't know how to fix it.
After I remove the RadAjaxManager, it fills the other textboxes in the grid but it does full post back, how to keep the ajax manager and fill the controls at the same time?
<telerik:radajaxmanager id="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="gv_about">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="gv_about" LoadingPanelID="RadAjaxLoadingPanel1">
</telerik:AjaxUpdatedControl>
<telerik:AjaxUpdatedControl ControlID="divMsgs"></telerik:AjaxUpdatedControl>
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:radajaxmanager>
<telerik:radajaxloadingpanel id="RadAjaxLoadingPanel1" runat="server">
</telerik:radajaxloadingpanel>
<telerik:radgrid id="gv_about" runat="server" cssclass="RadGrid" allowpaging="True"
pagesize="20" allowsorting="True" autogeneratecolumns="False" showstatusbar="True"
allowautomaticdeletes="True" allowautomaticinserts="True" allowautomaticupdates="True"
datasourceid="ObjectDataSource1" onitemdeleted="gv_about_ItemDeleted" oniteminserted="gv_about_ItemInserted"
onitemupdated="gv_about_ItemUpdated" onitemcommand="gv_about_ItemCommand" onprerender="gv_about_PreRender"
onitemcreated="gv_about_ItemCreated">
<MasterTableView CommandItemDisplay="Top" DataSourceID="ObjectDataSource1">
<commanditemsettings addnewrecordtext="اضافة" showrefreshbutton="False" />
<Columns>
<telerik:GridEditCommandColumn>
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn UniqueName="emp_num" HeaderText="رقم المحاضر" DataField="emp_num">
<HeaderStyle ForeColor="Silver" Width="25px"></HeaderStyle>
<ItemStyle ForeColor="Gray"></ItemStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="name" HeaderText="الاسم" DataField="name">
<HeaderStyle Width="220px"></HeaderStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="degree_name" HeaderText="الدرجة العلمية" DataField="degree_name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="college" HeaderText="الكلية والجامعة" DataField="college">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="type" HeaderText="نوع المحاضر" DataField="type">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn CommandName="Delete" Text="حذف" UniqueName="column">
</telerik:GridButtonColumn>
</Columns>
<EditFormSettings EditFormType="Template">
<EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>
<FormTemplate>
<table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none"
style="border-collapse: collapse;" >
<tr class="EditFormHeader">
<td colspan="2" style="font-size: small">
<b>استمارة تعارف</b>
</td>
</tr>
<tr>
<td>
<table id="Table3" cellspacing="1" cellpadding="1" width="250" border="0" class="module">
<tr>
<td>
نوع المحاضر:
</td>
<td>
<div id="div_lect_type">
<asp:RadioButtonList ID="rbt_lect_type" runat="server" AppendDataBoundItems="true"
AutoPostBack="true" CausesValidation="false" RepeatDirection="Horizontal" OnSelectedIndexChanged="rbt_lect_type_SelectedIndexChanged">
<asp:ListItem Value="1" Text="معين" Selected="True"></asp:ListItem>
<asp:ListItem Value="2" Text="منتدب خارجي"></asp:ListItem>
<asp:ListItem Value="3" Text="جديد"></asp:ListItem>
</asp:RadioButtonList>
</div>
<div id="div_lect">
<asp:TextBox ID="txt_lect_in" runat="server" AutoPostBack="True" OnTextChanged="txt_lect_in_TextChanged"></asp:TextBox>
<asp:AutoCompleteExtender ID="txt_lect_in_AutoCompleteExtender" runat="server" DelimiterCharacters=""
Enabled="True" MinimumPrefixLength="4" ServiceMethod="Get_Emp_AutoComplete" ServicePath="~/LectIn.asmx"
TargetControlID="txt_lect_in" BehaviorID="ACE_txt_lect_in" CompletionListCssClass="autocomplete_completionListElement"
CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" CompletionListItemCssClass="autocomplete_listItem"
EnableCaching="False">
</asp:AutoCompleteExtender>
</div>
</td>
</tr>
<tr>
<td>
الاسم:
</td>
<td>
<asp:TextBox ID="gv_txt_name" runat="server" Text='<%# Eval("name") %>' TabIndex="1">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
الموبايل:
</td>
<td>
<telerik:RadMaskedTextBox ID="gv_txt_mobile" runat="server" SelectionOnFocus="SelectAll"
Text='<%# Bind("tel_num") %>' PromptChar="_" Width="300px" Mask="(###)_########"
TabIndex="2">
</telerik:RadMaskedTextBox>
</td>
</tr>
<tr>
<td>
عنوان المراسلات:
</td>
<td>
<asp:TextBox ID="gv_txt_address" runat="server" Text='<%# Eval("address") %>' TabIndex="3">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
البريد الإلكتروني:
</td>
<td>
<asp:TextBox ID="gv_txt_email" runat="server" Text='<%# Eval("email") %>' TabIndex="4">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
الدرجة العلمية:
</td>
<td>
<asp:TextBox ID="gv_txt_degree" runat="server" Text='<%# Eval("degree_name") %>' TabIndex="5">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
الكلية والجامعة:
</td>
<td>
<%-- <asp:TextBox ID="gv_txt_college" runat="server" Text='<%# Eval("college") %>' TabIndex="6">
</asp:TextBox>--%>
</td>
</tr>
</table>
</td>
<td>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
</asp:Button>
<asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
CommandName="Cancel"></asp:Button>
</td>
</tr>
</table>
</FormTemplate>
</EditFormSettings>
</MasterTableView>
<ClientSettings>
<ClientEvents OnRowDblClick="RowDblClick"></ClientEvents>
</ClientSettings>
</telerik:radgrid>

place the insert part at above the table in listviews

actually i have below listview at my user control page:
and i want to replace the insert part to above the table as below:
and my listview code is as below:
<asp:ListView ID="lv_Uc_Module" runat="server"
onitemediting="lv_Uc_Module_ItemEditing"
onitemupdating="lv_Uc_Module_ItemUpdating"
onitemcanceling="lv_Uc_Module_ItemCanceling"
onitemdeleting="lv_Uc_Module_ItemDeleting"
OnItemDataBound="lv_Uc_Module_ItemDataBound"
InsertItemPosition="LastItem"
OnSorting="lv_Uc_Module_Sorting"
oniteminserting="lv_Uc_Module_ItemInserting"
DataKeyNames="EmpID">
<LayoutTemplate>
<table id="table_Lv_Layout" runat="server">
<tr id="tr_Table_Layout" runat="server">
<td id="td_Table_Layout" runat="server">
<table ID="itemPlaceholderContainer" runat="server" class="th_ItemTemplate">
<tr id="tr_Table_IphContainer" runat="server" style="">
<th id="th1_Table_IphContainer" runat="server">
<asp:Label ID="lb1_Table_IphContainer" runat="server" Text=""></asp:Label>
<asp:ImageButton ID="imb1_Table_IphContainer" CommandArgument="EmpID" CommandName="Sort" ImageUrl="~/Images/asc.png" runat="server" />
</th>
<th id="th2_Table_IphContainer" runat="server">
<asp:Label ID="lb2_Table_IphContainer" runat="server" Text=""></asp:Label>
<asp:ImageButton ID="imb2_Table_IphContainer" CommandArgument="EmpName" CommandName="Sort" ImageUrl="~/Images/asc.png" runat="server" />
</th>
<th id="th3_Table_IphContainer" runat="server">
<asp:Label ID="lb3_Table_IphContainer" runat="server" Text=""></asp:Label>
</th>
<th id="th4_Table_IphContainer" runat="server">
<asp:Label ID="lb4_Table_IphContainer" runat="server" Text=""></asp:Label>
</th>
<th id="th5_Table_IphContainer" runat="server">
<asp:Label ID="lb5_Table_IphContainer" runat="server" Text=""></asp:Label>
</th>
<th id="th6_Table_IphContainer" runat="server">
</th>
</tr>
<tr ID="itemPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr id="tr_Validate_Table_Layout" runat="server">
<td id="td_Validate_Table_Layout" runat="server" style="text-align: center;background-color: #CCCCCC;">
<asp:ValidationSummary ID="ValidationSummary1" runat="server" HeaderText="You received the following errors:" ShowMessageBox="true" ShowSummary="false" ValidationGroup="VGEditTmp" />
<asp:ValidationSummary ID="ValidationSummary2" runat="server" HeaderText="You received the following errors:" ShowMessageBox="true" ShowSummary="false" ValidationGroup="VGInsertTmp" />
</td>
</tr>
</table>
<br />
<asp:DataPager ID="lv_DataPager" runat="server" PagedControlID="lv_Uc_Module" PageSize="5" OnPreRender="lv_DataPager_PreRender">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="true" ShowLastPageButton="true" />
<asp:TemplatePagerField>
<PagerTemplate>
<span style="color:Maroon;">Records:
<%# Container.StartRowIndex >= 0 ? (Container.StartRowIndex + 1) : 0 %>
-
<%# (Container.StartRowIndex + Container.PageSize) > Container.TotalRowCount ? Container.TotalRowCount : (Container.StartRowIndex + Container.PageSize)%>
of
<%# Container.TotalRowCount %>
<span style="color:Red;">
OR
</span>
<span style="color: Blue;">
Page
<%# Container.TotalRowCount>0 ? (Container.StartRowIndex / Container.PageSize) + 1 : 0 %>
of
<%# Math.Ceiling((double)Container.TotalRowCount / Container.PageSize) %>
</span>
</span>
</PagerTemplate>
</asp:TemplatePagerField>
</Fields>
</asp:DataPager>
</LayoutTemplate>
<ItemTemplate>
<tr class="tr_ItemTemplate">
<td>
<asp:Label ID="lb_ItemTemp1" runat="server" Text='' />
</td>
<td>
<asp:Label ID="lb_ItemTemp2" runat="server" Text='' />
</td>
<td>
<asp:Label ID="lb_ItemTemp3" runat="server" Text='' />
</td>
<td>
<asp:Label ID="lb_ItemTemp4" runat="server" Text='' />
</td>
<td>
<asp:Label ID="lb_ItemTemp5" runat="server" Text='' />
</td>
<td>
<asp:Button ID="btn_Edit" runat="server" CommandName="Edit" Text="" CssClass="btn_Edit" CausesValidation="True" />
<asp:Button ID="btn_Delete" runat="server" CommandName="Delete" Text="" CssClass="btn_Delete" CausesValidation="false" OnClientClick="return confirm('Are you sure you want to delete this item?');" />
</td>
</tr>
</ItemTemplate>
<EditItemTemplate>
<tr style="background-color:#008A8C;color: #FFFFFF;">
<td>
<asp:Label ID="lb_ItemTemp1" runat="server" Text='' />
</td>
<td>
<asp:TextBox ID="td_EditTemp1" runat="server" Text='' ValidationGroup="VGEditTmp" />
<asp:RequiredFieldValidator runat="server" ID="RequiredName" ControlToValidate="td_EditTemp1" ErrorMessage="Name is required" ValidationGroup="VGEditTmp" Display="None" ></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="regName" runat="server" ControlToValidate="td_EditTemp1" ValidationExpression="^[a-zA-Z'.\s]{1,50}" ErrorMessage="Enter a valid Name" ValidationGroup="VGEditTmp" Display="None"></asp:RegularExpressionValidator>
</td>
<td>
<asp:TextBox ID="td_EditTemp2" runat="server" Text='' />
</td>
<td>
<asp:TextBox ID="td_EditTemp3" runat="server" Text='' ValidationGroup="VGEditTmp" />
<asp:RangeValidator ID="ValidateAge" runat="server" ControlToValidate="td_EditTemp3" MinimumValue="18" MaximumValue="50" Type="Integer" ErrorMessage="Age should be within the valid interval(18-50)!" ValidationGroup="VGEditTmp" SetFocusOnError="true" Display="None"></asp:RangeValidator>
</td>
<td>
<asp:TextBox ID="td_EditTemp4" runat="server" Text='' />
</td>
<td>
<asp:Button ID="btn_Update" runat="server" CommandName="Update" Text="Update" ValidationGroup="VGEditTmp" />
<asp:Button ID="btn_Cancel" runat="server" CommandName="Cancel" Text="Cancel" CausesValidation="false" />
</td>
</tr>
</EditItemTemplate>
<InsertItemTemplate>
<tr style="background-color:#008A8C;font-weight: bold;color: #FFFFFF;">
<td>
</td>
<td>
<asp:TextBox ID="td_EditTemp1" runat="server" Text='' ValidationGroup="VGInsertTmp" />
<asp:RequiredFieldValidator runat="server" ID="RequiredName" ControlToValidate="td_EditTemp1" ErrorMessage="Name is required" ValidationGroup="VGInsertTmp" Display="None"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="regName" runat="server" ControlToValidate="td_EditTemp1" ValidationExpression="^[a-zA-Z'.\s]{1,50}" ErrorMessage="Enter a valid Name" ValidationGroup="VGInsertTmp" Display="None"></asp:RegularExpressionValidator>
</td>
<td>
<asp:TextBox ID="td_EditTemp2" runat="server" Text='' />
</td>
<td>
<asp:TextBox ID="td_EditTemp3" runat="server" Text='' ValidationGroup="VGInsertTmp" />
<asp:RangeValidator ID="ValidateAge" runat="server" ControlToValidate="td_EditTemp3" MinimumValue="18" MaximumValue="50" Type="Integer" ErrorMessage="Age should be within the valid interval(18-50)!" ValidationGroup="VGInsertTmp" SetFocusOnError="true" Display="None"></asp:RangeValidator>
</td>
<td>
<asp:TextBox ID="td_EditTemp4" runat="server" Text='' />
</td>
<td>
<asp:Button ID="btn_Insert" runat="server" CommandName="Insert" Text="Insert" ValidationGroup="VGInsertTmp" />
<asp:Button ID="btn_Cancel" runat="server" CommandName="Cancel" Text="Clear" CausesValidation="false" />
</td>
</tr>
</InsertItemTemplate>
</asp:ListView>
could you please guide me how to overcome this problem. i'm using asp.net and c#.
Appreciate your consideration.
I think you need to change your GridView's InsertItemPosition property from InsertItemPosition="LastItem"
to
InsertItemPosition="FirstItem"
in your declaration.

modal popup extender problem

i use modal popup extender to show my details in another separate window it is a panel contains some controls the problem is ::
when i click on my button which contains::
the Show() method the parent page just frozen and no popup appears at all on the other side i have a grid view when i click on the last button on it the popup appears where the other buttons on the grid view make the same behavior of my first button , i donot know what is the problem my panel visibility = true and no setting in my behind code..i view the source and i find the panel with its contents then why the popup window doesnot appear..i search alot but i donot find a solution to my problem ..
my aspx::
<asp:Panel id="master_editMode" runat="server" >
<div id="masterDiv" style="width:98%" dir="rtl">
<div id="masterControls" align="center">
<table border="0" width="98%">
<tr>
<td align="center" dir="rtl">
<asp:ObjectDataSource ID="ObjDS_AllTasks" runat="server"
SelectMethod="Get_All_Tasks" TypeName="DocumentFlowModuleDTO.TaskDTO">
</asp:ObjectDataSource>
<asp:HiddenField ID="hd_Task_Code" runat="server" />
<table>
<tr>
<td>
<asp:Label ID="Label11" runat="server" Text="Search for Task" Visible="False"></asp:Label>
</td>
<td align="right">
<asp:TextBox ID="txt_Search" runat="server" AutoPostBack="True"
ontextchanged="txt_Search_TextChanged" Width="200px" Visible="False"></asp:TextBox>
</td>
<td>
</td>
</tr>
<tr>
<td colspan="3">
<asp:GridView ID="grd_AllTasks" runat="server" AllowPaging="True"
AutoGenerateColumns="False" CssClass="Alternating" DataKeyNames="task_code"
DataSourceID="ObjDS_AllTasks"
onpageindexchanging="grd_AllTasks_PageIndexChanging"
onrowdatabound="grd_AllTasks_RowDataBound" style="margin-right: 0px">
<RowStyle VerticalAlign="Top" />
HeaderText="ÍÐÝ">
<ItemTemplate>
<asp:ImageButton ID="btn_Delete_Task" runat="server"
CommandArgument="<%# Bind('task_code') %>" Height="33px"
ImageUrl="~/Images/delete.png" oncommand="btn_Delete_Task_Command"
Width="67px" />
<cc1:ConfirmButtonExtender ID="btn_Delete_Task_ConfirmButtonExtender"
runat="server" ConfirmText="åá ÊÑíÏ ÍÐÝ æËíÞÉ ÇáÇÚÊãÇÏ ¿" Enabled="True"
TargetControlID="btn_Delete_Task">
</cc1:ConfirmButtonExtender>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<HeaderStyle HorizontalAlign="Right" />
</asp:GridView>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="right" dir="rtl">
<asp:Label ID="lbl_TaskName" runat="server" Font-Bold="True" Font-Size="13pt"></asp:Label>
</td>
</tr>
<tr>
<td align="center" dir="rtl" style="height: 196px">
<table>
<tr>
<td align="left">
<asp:Label ID="lbl_No_States" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
</td>
<td align="right">
<asp:ImageButton ID="btn_AddStatesToTask" runat="server"
ImageUrl="Images/add.png" onclick="btn_AddStatesToTask_Click" Visible="False" />
<asp:Button ID="Dummy_btn2" runat="server" Text="Button" Style="display:none;" />
<cc1:ModalPopupExtender ID="btn_AddStatesToTask_ModalPopupExtender"
runat="server"
TargetControlID="Dummy_btn2"
BackgroundCssClass="modalBackground"
PopupControlID="pnl_Add_States"
DropShadow="True">
</cc1:ModalPopupExtender>
</td>
</tr>
</table>
<asp:HiddenField ID="hd_StateSerial" runat="server" />
<asp:HiddenField ID="hd_StateRowIndex" runat="server" />
<asp:GridView ID="grd_States" runat="server" AllowPaging="True" DataKeyNames="state_serial"
onpageindexchanging="grd_States_PageIndexChanging" Visible="False"
CssClass="Alternating" AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="state_name" HeaderText="ÇáãÑÍáÉ"
ShowHeader="False" />
<asp:BoundField DataField="state_order" HeaderText="ÊÑÊíÈ ÇáãÑÍáÉ"
ShowHeader="False" />
<asp:TemplateField HeaderText="Power" ShowHeader="False">
<EditItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" />
</EditItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="chb_StatePower" runat="server"
Checked='<%# Convert.ToBoolean(Eval("power_flag")) %>' Enabled="False" />
</ItemTemplate>
<ItemStyle Width="40px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="New" ShowHeader="False">
<EditItemTemplate>
<asp:CheckBox ID="CheckBox3" runat="server" />
<asp:Button ID="Dummy_btn4" runat="server" Text="Button" Style="display:none;" />
<cc1:ModalPopupExtender ID="btn_TaskState_Edit_ModalPopupExtender" runat="server"
TargetControlID="Dummy_btn4"
BackgroundCssClass="modalBackground"
PopupControlID="pnl_Add_States"
DropShadow="True">
</cc1:ModalPopupExtender>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ÍÐÝ" ShowHeader="False">
<ItemTemplate>
<asp:ImageButton ID="btn_TaskState_Delete" runat="server"
CommandArgument="<%# Bind('state_serial') %>" Height="26px"
ImageUrl="~/Images/delete.png" oncommand="btn_TaskState_Delete_Command"
Width="47px" />
<cc1:ConfirmButtonExtender ID="btn_TaskState_Delete_ConfirmButtonExtender"
runat="server" ConfirmText="åá ÊÑíÏ ÍÐÝ ÇáãÑÍáÉ ¿" Enabled="True"
TargetControlID="btn_TaskState_Delete">
</cc1:ConfirmButtonExtender>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</td>
</tr>
<tr>
<td>
<asp:ObjectDataSource ID="ObjectDataSource_States" runat="server"
SelectMethod="Select_TaskStates" TypeName="DocumentFlowModule.DTO.TaskStateDTO">
<SelectParameters>
<asp:Parameter Name="task_code" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
</td>
</tr>
</table>
</div>
</div>
</asp:Panel>
<asp:Panel ID="pnl_Add_Task" runat="server" CssClass="modalPopup"><%-- Style="display:none;"--%>
<div id="div3" style="width: 95%">
<div id="div4" align="center">
<table>
<tr>
<td>
<asp:UpdatePanel ID="UpPnl1" runat="server">
<ContentTemplate>
<table dir="rtl" style="text-align: right">
<tr bgcolor="#f1ece2">
<th align="right" height="35" valign="middle" colspan="3">
<asp:Label ID="lbl_New_Task" runat="server" Font-Bold="False" Font-Size="14pt"
Text="ÅÖÇÝÉ æËíÞÉ ÇÚÊãÇÏ" Visible="False"></asp:Label>
<asp:Label ID="lbl_Edit_Task" runat="server" Font-Bold="False" Font-Size="14pt"
Text="ÊÚÏíá æËíÞÉ ÇÚÊãÇÏ" Visible="False"></asp:Label>
</th>
</tr>
<tr>
<td class="title" width="160">
<asp:Label ID="Label1" runat="server" Text="Task Name"></asp:Label>
</td>
<td style="width: 140px">
<asp:TextBox ID="txt_TaskName" runat="server"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txt_TaskName" ErrorMessage="*" ValidationGroup="G1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="title" width="160">
<asp:Label ID="Label10" runat="server" Text="DataBase Name"></asp:Label>
</td>
<td style="width: 140px">
<asp:DropDownList ID="ddl_DataBases" runat="server" AutoPostBack="True"
ondatabound="ddl_DataBases_DataBound"
onselectedindexchanged="ddl_DataBases_SelectedIndexChanged">
</asp:DropDownList>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="ddl_DataBases" ErrorMessage="*" InitialValue="--Select--"
ValidationGroup="G1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="title" width="160">
<asp:Label ID="Label2" runat="server" Text="Table Name"></asp:Label>
</td>
<td style="width: 140px">
<asp:DropDownList ID="ddl_Tables" runat="server" AutoPostBack="True"
ondatabound="ddl_Tables_DataBound"
onselectedindexchanged="ddl_Tables_SelectedIndexChanged">
</asp:DropDownList>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ControlToValidate="ddl_Tables" ErrorMessage="*" InitialValue="--Select--"
ValidationGroup="G1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="title" width="160">
<asp:Label ID="Label17" runat="server" Text="Table Key"></asp:Label>
</td>
<td style="width: 140px">
<asp:Label ID="lbl_Key" runat="server"></asp:Label>
<asp:CheckBoxList ID="cbl_Columns" runat="server">
</asp:CheckBoxList>
</td>
<td>
<asp:Label ID="lbl_Select_Key" runat="server" ForeColor="Red"></asp:Label>
</td>
</tr>
<tr>
<td class="title" width="160">
<asp:Label ID="Label18" runat="server" Text="Current Record State"></asp:Label>
</td>
<td style="width: 140px">
<asp:DropDownList ID="ddl_Columns" runat="server" AutoPostBack="True"
ondatabound="ddl_Columns_DataBound">
</asp:DropDownList>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
ControlToValidate="ddl_Columns" ErrorMessage="*" InitialValue="--Select--"
ValidationGroup="G1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="title" width="160">
<asp:Label ID="Label5" runat="server" Text="Form View "></asp:Label>
</td>
<td style="width: 140px">
<asp:TextBox ID="txt_F_View" runat="server"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server"
ControlToValidate="txt_F_View" ErrorMessage="*" InitialValue="--Select--"
ValidationGroup="G1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="title" width="160">
<asp:Label ID="Label6" runat="server" Text="Form New"></asp:Label>
</td>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td dir="rtl" align="center">
<asp:ImageButton ID="btn_OK" runat="server" ImageUrl="~/Images/add.png"
onclick="btn_OK_Click" ValidationGroup="G1" Visible="False" />
<asp:ImageButton ID="btn_Edit" runat="server" ImageUrl="~/Images/edit.png"
onclick="btn_Edit_Click" ValidationGroup="G1" Visible="False" />
<asp:ImageButton ID="btn_Cancel_Task" runat="server" CausesValidation="False"
Height="36px" ImageUrl="~/Images/cancel.png" onclick="btn_Cancel_Task_Click" />
</td>
</tr>
</table>
</div>
</div>
</asp:Panel>
the btn_add _task does not make my popup appear just freeze the parent page
my .cs
protected void btn_Add_Task_Click(object sender, EventArgs e)
{
//AjaxControlToolkit.ModalPopupExtender modal1 = (AjaxControlToolkit.ModalPopupExtender) table1.FindControl("btn_Add_Task_ModalPopupExtender");
//modal1.Show();
grd_States.Visible = false;
lbl_No_States.Text = "";
btn_AddStatesToTask.Visible = false;
lbl_TaskName.Text = "";
//master_editMode.Visible = true;
//pnl_Add_Task.Visible = true;
btn_OK.Visible = true;
btn_Edit.Visible = false;
lbl_New_Task.Visible = true;
lbl_Edit_Task.Visible = false;
txt_TaskName.Text = "";
ddl_DataBases.ClearSelection();
ddl_Tables.Items.Clear();
ddl_Columns.Items.Clear();
cbl_Columns.Items.Clear();
txt_F_New.Text = "";
txt_F_View.Text = "";
txt_Params.Text = "";
txt_SP_Name.Text = "";
btn_Add_Task_ModalPopupExtender.Show();
}
thanks in advance
EDITED::
<table align="center" dir="rtl">
<tr>
<td >
<asp:Button ID="Dummy_btn" runat="server" Text="Button" Style="display:none;" />
<asp:Button ID="btn_Add_Task" runat="server" Text="ÅÖÇÝÉ æËíÞÉ ÇÚÊãÇÏ ÌÏíÏÉ"
onclick="btn_Add_Task_Click" Font-Bold="True" Font-Size="12pt"
ForeColor="#0066FF" />
<cc1:ModalPopupExtender ID="btn_Add_Task_ModalPopupExtender" runat="server"
TargetControlID="Dummy_btn"
PopupControlID="pnl_Add_Task"
BackgroundCssClass="modalBackground"
DropShadow="True" >
</cc1:ModalPopupExtender>
</td>
</tr>
</table>`
If you want your modal popup to be displayed when the user clicks on the btn_Add_Task button, you should set that button as the TargetControlID of the extender:
<cc1:ModalPopupExtender ID="btn_Add_Task_ModalPopupExtender" runat="server"
TargetControlID="btn_Add_Task" PopupControlID="pnl_Add_Task"
BackgroundCssClass="modalBackground" DropShadow="True" />
In your current code, the modal popup is triggered by a button named Dummy_btn, which I can't find in your markup, but which probably isn't what you want.
We had many issues with ajax popup. you might want to try the approach we have been using for past one month or so with out any issues. This approach creates a popup with out need of ajax / jquery / javascript /css/ update panel .
here:
A modal popup with out using ajax, update panel, jquery or javascript- surprisingly this seems to work

Categories

Resources