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
Related
I used ASP:Login to take a Login form for my page.
Now I have 2 problem and I try to find a solution but ... #_#.
Now, I enter to login page. Type user, type password, then Enter
Problem 1 : Enter key not focus to Login button. It's mean, I must click to Login button to login. How can to set default button in this case ?
Problem 2 : Ok. Logged in. The browser (Chrome, Firefox ...) ask to save password. Ok. Saved.
And then, when I enter to login page in another time. The password will not autofill when I enter the username (browser still save username and password info).
Did I take a mistake in my setting or my code ? :(
My code :
<asp:Login ID="Login1" runat="server" BackColor="transparent" Font-Names="Verdana"
Font-Size="0.8em" ForeColor="#333333" Height="147px"
LoginButtonText="Đăng nhập" onloggingin="Login1_LoggingIn"
RememberMeText="Nhớ password cho lần đăng nhập sau."
TitleText="Đăng nhập hệ thống" Width="400px"
FailureText="Đăng nhập không thành công!"
HelpPageText="Anh, chị là khách hàng? "
onauthenticate="Login1_Authenticate"
PasswordRequiredErrorMessage="Chưa nhập Password."
UserNameRequiredErrorMessage="Chưa nhập User Name." BorderColor="#339933"
BorderStyle="Solid" BorderWidth="1px" CssClass="border">
<HyperLinkStyle Font-Size="10pt" HorizontalAlign="Left" />
<InstructionTextStyle Font-Italic="True" ForeColor="Black" />
<LabelStyle Wrap="True" />
<LayoutTemplate>
<table cellpadding="4" cellspacing="0" style="border-collapse:collapse;">
<tr>
<td>
<table cellpadding="0" style="height:147px;width:400px;">
<tr>
<td align="left" colspan="2"
style="color:White;background-color:#006D55;font-size:11pt;font-weight:bold;height:25px;white-space:nowrap; padding-left: 10px;">
Đăng nhập hệ thống</td>
</tr>
<tr>
<td align="left" colspan="2">
<br>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label>
</td>
<td align="left">
<asp:TextBox ID="UserName" runat="server" Font-Size="10pt" Height="22px"
Width="250px" CssClass="border"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server"
ControlToValidate="UserName" ErrorMessage="Chưa nhập User Name."
ToolTip="Chưa nhập User Name." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
</td>
<td align="left">
<asp:TextBox ID="Password" runat="server" Font-Size="10pt" Height="22px"
TextMode="Password" Width="250px" CssClass="border" Wrap="False"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server"
ControlToValidate="Password" ErrorMessage="Chưa nhập Password."
ToolTip="Chưa nhập Password." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="left" colspan="2">
<br />
</td>
</tr>
<tr>
<td colspan="2">
<asp:CheckBox ID="RememberMe" runat="server"
Text="Nhớ password cho lần đăng nhập sau." AutoPostBack="True" />
</td>
</tr>
<tr>
<td align="center" colspan="2" style="color:Red;">
<asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="LoginButton" runat="server" BackColor="#006D55"
BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" CommandName="Login"
Font-Names="Verdana" Font-Size="11pt" ForeColor="White" Height="25px"
Text="Login" ValidationGroup="Login1" Width="100%" />
</td>
</tr>
<tr>
<td align="left" colspan="2">
<hr />
</td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:HyperLink ID="HelpLink" runat="server" Font-Size="10pt">Anh, chị chưa có tài khoản ? </asp:HyperLink>
</td>
</tr>
<tr align="center">
<td align="left" colspan="2" style="padding-top: 10px;">
<dx:ASPxButton ID="ASPxButton1" runat="server" Text="Tạo tài khoản"
onclick="ASPxButton1_Click" Width="100%"
Font-Size="11pt" Font-Names="Verdana" BackColor="White"
ForeColor="#006D55" Height="20px" HorizontalAlign="Center">
<HoverStyle BackColor="#A6DDD1" Font-Bold="True">
</HoverStyle>
<Border BorderColor="#006D55" />
</dx:ASPxButton>
</td>
</tr>
</table>
</td>
</tr>
</table>
</LayoutTemplate>
<LoginButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC" BorderStyle="Solid"
BorderWidth="1px" Font-Names="Verdana" Font-Size="10pt" ForeColor="#284775"
Height="25px" Width="80px" />
<TextBoxStyle Font-Size="10pt" Height="22px" Width="150px" />
<TitleTextStyle BackColor="#5D7B9D" Font-Bold="True" Font-Size="10pt"
ForeColor="White" Height="25px" HorizontalAlign="Left" Wrap="False" />
sp_compa.Service1 ws = new sp_compa.Service1();
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack) return;
Session["STATION_CODE"] = "";
Session["COMP_CODE"] = "";
Session["COMP_NAME"] = "";
Session["UserName"] = "";
Session["PassWord"] = "";
Session.Timeout = 120;
}
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
string user = this.Login1.UserName.Trim();
string password = this.Login1.Password.Trim();
DataSet ds = sp.get_user_new(user, clsdb.identity);
Session["dsuser"] = ds;
if (ds != null && ds.Tables[0].Rows.Count > 0)
{
DataRow row = ds.Tables[0].Rows[0];
if (this.Login1.Password.ToUpper().Trim().Equals(row["PassWord"].ToString().ToUpper()))
{
e.Authenticated = true;
Session["UserName"] = user;
Session["PassWord"] = password;
Session["COMP_CODE_User"] = row["COMP_CODE"];
if ((bool)row["KH"] == false)
Response.Redirect("~/Home.aspx");
else
{
Response.Redirect("~/ttkh.aspx");
}
}
else
{
}
}
e.Authenticated = false;
}
Solution for Problem 1 is to use Asp.Net panel and use it's Defauenter code hereltButton property.
For example,
<asp:Login ID="Login1" runat="server">
<LayoutTemplate>
<asp:Panel ID="Panel1" runat="server" DefaultButton = "LoginButton">
<table cellpadding="4" cellspacing="0" style="border-collapse:collapse;">
<tr>
<td>
<table cellpadding="0" style="height:147px;width:400px;">
<tr>
<td align="left" colspan="2"
style="color:White;background-color:#006D55;font-size:11pt;font-weight:bold;height:25px;white-space:nowrap; padding-left: 10px;">
Đăng nhập hệ thống</td>
</tr>
<tr>
<td align="left" colspan="2">
<br>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label>
</td>
<td align="left">
<asp:TextBox ID="UserName" runat="server" Font-Size="10pt" Height="22px"
Width="250px" CssClass="border"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server"
ControlToValidate="UserName" ErrorMessage="Chưa nhập User Name."
ToolTip="Chưa nhập User Name." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
</td>
<td align="left">
<asp:TextBox ID="Password" runat="server" Font-Size="10pt" Height="22px"
TextMode="Password" Width="250px" CssClass="border" Wrap="False"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server"
ControlToValidate="Password" ErrorMessage="Chưa nhập Password."
ToolTip="Chưa nhập Password." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="left" colspan="2">
<br />
</td>
</tr>
<tr>
<td colspan="2">
<asp:CheckBox ID="RememberMe" runat="server"
Text="Nhớ password cho lần đăng nhập sau." AutoPostBack="True" />
</td>
</tr>
<tr>
<td align="center" colspan="2" style="color:Red;">
<asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="LoginButton" runat="server" BackColor="#006D55"
BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" CommandName="Login"
Font-Names="Verdana" Font-Size="11pt" ForeColor="White" Height="25px"
Text="Login" ValidationGroup="Login1" Width="100%" />
</td>
</tr>
<tr>
<td align="left" colspan="2">
<hr />
</td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:HyperLink ID="HelpLink" runat="server" Font-Size="10pt">Anh, chị chưa có tài khoản ? </asp:HyperLink>
</td>
</tr>
<tr align="center">
<td align="left" colspan="2" style="padding-top: 10px;">
<dx:ASPxButton ID="ASPxButton1" runat="server" Text="Tạo tài khoản"
onclick="ASPxButton1_Click" Width="100%"
Font-Size="11pt" Font-Names="Verdana" BackColor="White"
ForeColor="#006D55" Height="20px" HorizontalAlign="Center">
<HoverStyle BackColor="#A6DDD1" Font-Bold="True">
</HoverStyle>
<Border BorderColor="#006D55" />
</dx:ASPxButton>
</td>
</tr>
</table>
</td>
</tr>
</table>
</asp:Panel>
</LayoutTemplate>
</asp:Login>
In regards to problem 2, I do not know why your browser is not pushing password back to the text box.
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>
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".
The button click inside of Ajax update panel didn't work in Chrome and IE but it work in Firefox. I add files in this links.any one can help me? i will be glad. thanks
My Code Address -
Error Screen İmage
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table id="TblMain" cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td align="left">
<div class="module_box">
<asp:HyperLink ID="lnkUseCoupons" CssClass="lightbox addbutton" runat="server" NavigateUrl="/store/addcoupon.aspx"><%=GetGlobalResourceObject("lang", "AddCoupon")%></asp:HyperLink>
<div class="clear">
</div>
<asp:Label ID="lblCouponInfo" runat="server" EnableViewState="False"></asp:Label>
<asp:LinkButton ID="btnDeleteCoupon" runat="server" CssClass="deletebutton" Visible="False"><%=GetGlobalResourceObject("lang", "Delete")%></asp:LinkButton>
</div>
</td>
</tr>
<tr>
<td id="SepetlerContainer" runat="server">
<div class="module_box">
<label class="subtitle">
<%=GetGlobalResourceObject("lang", "Carts")%></label>
<table cellpadding="1" cellspacing="0" border="0" width="100%">
<tr>
<td colspan="2">
<div id="transferalert" visible="false" runat="server" class="alert">
<%=GetGlobalResourceObject("lang", "CartMsg5")%></div>
</td>
</tr>
<tr>
<td align="left">
<table id="TblSepetler" cellspacing="0" cellpadding="0" width="100%" border="0" runat="server">
<tr>
<td>
<%=GetGlobalResourceObject("lang", "SelectCart")%>
<asp:DropDownList ID="ddlSepet" runat="server" DataTextField="CartType" DataValueField="ShoppingCartDefId"
AutoPostBack="True">
</asp:DropDownList>
<asp:HyperLink ID="lnkaddnew" CssClass="addbutton lightbox" runat="server"><%=GetGlobalResourceObject("lang", "AddNew")%></asp:HyperLink>
<asp:HyperLink ID="lnkEdit" CssClass="editbutton lightbox" runat="server"><%=GetGlobalResourceObject("lang", "Edit")%></asp:HyperLink>
<asp:LinkButton ID="lnkDeleteCart" CssClass="deletebutton" runat="server"><%=GetGlobalResourceObject("lang", "Delete")%></asp:LinkButton>
</td>
</tr>
</table>
</td>
<td align="right">
<table id="TblTransfer" runat="server">
<tr>
<td>
<asp:Label ID="lblTr" runat="server"><%=GetGlobalResourceObject("lang", "SelectTargetCart")%></asp:Label>
<asp:DropDownList ID="ddlTransferSepet" runat="server" DataTextField="CartType" DataValueField="ShoppingCartDefId"
AutoPostBack="True">
</asp:DropDownList>
<asp:LinkButton ID="lnkTransfer" CssClass="transferbutton" runat="server"><%=GetGlobalResourceObject("lang", "TransferToCart")%></asp:LinkButton>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td id="SepetContainer" runat="server">
<div class="module_box">
<label>
<asp:Label ID="lblKampanya0" runat="server"></asp:Label></label>
<table id="TblSepet" cellspacing="0" cellpadding="2" width="100%" border="0">
<tr>
<td>
<asp:DataGrid ID="DataGrid0" runat="server" Width="100%" AutoGenerateColumns="False"
CellPadding="4" DataKeyField="Qty" CssClass="datalist" HeaderStyle-CssClass="title"
GridLines="none" ItemStyle-CssClass="row">
<Columns>
<asp:TemplateColumn Visible="False">
<ItemTemplate>
<asp:Label ID="ProductId" runat="server" Visible="False" Text='<%# Eval("ProductId") %>'> </asp:Label>
<asp:Label ID="RecordId" runat="server" Visible="False" Text='<%# Eval("RecordId") %>'> </asp:Label>
</ItemTemplate>
<HeaderStyle Width="0px"></HeaderStyle>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="<%$ Resources:lang, ProductCode%>" Visible="False">
<ItemTemplate>
<asp:HyperLink ID="Hyperlink2" runat="server" Text='<%# Eval("ProductCode") %>'
NavigateUrl='<%# String.Format(BaseUrl2() + "{0}" + ".aspx",Eval("Url").ToString().Remove(Eval("Url").ToString().Length - 1, 1)) %>'> </asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn ItemStyle-Width="80px" HeaderText="<%$ Resources:lang, ProductImage%>"
HeaderStyle-HorizontalAlign="Center">
<ItemStyle HorizontalAlign="Center" />
<ItemTemplate>
<img alt="" class="thumb" src='<%# "/store/makethumb.aspx?file=" + Eval("Path") + "&intSize=50" %>' />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="<%$ Resources:lang, ProductName%>">
<ItemTemplate>
<itemstyle wrap="False"></itemstyle>
<asp:HyperLink ID="Hyperlink7" runat="server" Text='<%# Eval("ProductName") %>'
NavigateUrl='<%# string.Format(BaseUrl2() + "{0}" + ".aspx",Eval("Url").ToString().Remove(Eval("Url").ToString().Length - 1, 1)) %>'> </asp:HyperLink>
<asp:Label ID="Hy7a" runat="server" Text='<%# Eval("Description").ToString().Replace(",","</br>") %>'></asp:Label>
<asp:HyperLink ID="Hyperlink1a6" Visible='<%# visible1(Eval("ProductId"))%>'
runat="server" NavigateUrl='<%# linkgen1() %> '> </asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="<%$ Resources:lang, Point%>">
<ItemTemplate>
<itemstyle wrap="False"></itemstyle>
<asp:Label ID="lblPuan" runat="server"> </asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="<%$ Resources:lang, Quantity%>">
<ItemStyle Wrap="False" Width="120" HorizontalAlign="left"></ItemStyle>
<ItemTemplate>
<asp:TextBox ID="Quantity" Enabled='<%# Interaction.IIf(Eval("ProductId").ToString().intyap() == tmpOrder.Campain.ProductId & tmpOrder.Campain.DiscountType == 2, false, true)%>'
runat="server" Text='<%# Eval("Qty") %>' MaxLength="4"
Columns="4"> </asp:TextBox>
<asp:Label ID="UnitId" runat="server" Visible="False" Text='<%# Eval("UnitId") %>'> </asp:Label>
<asp:Label runat="server" Text='<%# Eval("BirimAdi") %>' ID="Label18"> </asp:Label>
</ItemTemplate>
<HeaderStyle Wrap="False" HorizontalAlign="center"></HeaderStyle>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="<%$ Resources:lang, QtyPrice%>">
<ItemStyle Wrap="False" HorizontalAlign="Right"></ItemStyle>
<ItemTemplate>
<asp:Label runat="server" Text='<%# deger001(Convert.ToDecimal(Eval("Rate").ToString()),Convert.ToDecimal(Eval("Indirim").ToString()),Convert.ToDecimal(Eval("SatisFiyati").ToString()),Convert.ToDecimal(Eval("ValueAdd").ToString()),Convert.ToDecimal(Eval("qty").ToString()),Convert.ToInt32(Eval("ProductId").ToString()))%>'
ID="Label9" name="Label9"> </asp:Label>
</ItemTemplate>
<HeaderStyle Wrap="False" HorizontalAlign="Right"></HeaderStyle>
</asp:TemplateColumn>
<asp:BoundColumn DataField="KdvRate" DataFormatString="%{0:0}" HeaderText="<%$ Resources:lang, TaxRate%>">
<ItemStyle Wrap="False" HorizontalAlign="Right"></ItemStyle>
<HeaderStyle Wrap="False" HorizontalAlign="Right"></HeaderStyle>
</asp:BoundColumn>
<asp:TemplateColumn HeaderText="<%$ Resources:lang, PiceWithoutTax%>">
<ItemStyle Wrap="False" HorizontalAlign="Right"></ItemStyle>
<ItemTemplate>
<asp:Label ID="Label12" runat="server" Text='<%# deger002(Convert.ToDecimal(Eval("Rate").ToString()),Convert.ToDecimal(Eval("Indirim").ToString()),Convert.ToDecimal(Eval("SatisFiyati").ToString()),Convert.ToDecimal(Eval("ValueAdd").ToString()),Convert.ToDecimal(Eval("qty").ToString()),Convert.ToInt32(Eval("ProductId").ToString())) %>'> </asp:Label>
</ItemTemplate>
<HeaderStyle Wrap="False" HorizontalAlign="Right"></HeaderStyle>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="<%$ Resources:lang, Selection%>">
<ItemStyle HorizontalAlign="Justify"></ItemStyle>
<ItemTemplate>
<center>
<asp:CheckBox ID="Remove" runat="server"></asp:CheckBox>
</center>
</ItemTemplate>
<HeaderStyle Wrap="False"></HeaderStyle>
</asp:TemplateColumn>
<asp:BoundColumn DataField="Barcode" HeaderText="<%$ Resources:lang, Barcode%>" Visible="false">
</asp:BoundColumn>
</Columns>
</asp:DataGrid>
</td>
</tr>
<tr>
<td>
<div id="stokalert" visible="false" runat="server" class="alert">
<asp:Label ID="lblStokError" runat="Server" EnableViewState="False"></asp:Label></div>
</td>
</tr>
<tr>
<td align="right">
<asp:LinkButton ID="lnkUpdate" runat="server" CssClass="savebutton"><%= GetGlobalResourceObject("lang", "Update")%></asp:LinkButton>
<asp:LinkButton ID="lnkDelete" runat="server" CssClass="deletebutton"><%= GetGlobalResourceObject("lang", "Delete")%></asp:LinkButton>
</td>
</tr>
<tr>
<td>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td align="left">
<asp:DataList ID="dlCargoList" runat="server" RepeatDirection="vertical">
<HeaderTemplate>
<b>
<%=GetGlobalResourceObject("lang", "ShippingPrice")%></b></HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblCargoName" runat="server" Text='<%# Eval("CargoName") %>'></asp:Label>:
<asp:Label ID="lblCargoText" runat="server" Text='<%# publicItems.CurrencySymbolLeft + " " + publicItems.formatCurDoviz(Convert.ToDecimal(Eval("CargoPrice").ToString()) * (publicItems.DefaultCurrencyRate /publicItems. CurrencyRate))+ " " + publicItems.CurrencySymbolRight %>'></asp:Label>
</ItemTemplate>
</asp:DataList>
</td>
<td align="right">
<table id="tblfy" cellspacing="0" cellpadding="2" border="0" runat="server">
<tr>
<td align="right">
<asp:Label ID="lblAgirlik" runat="server" Visible="False"><%=GetGlobalResourceObject("lang", "TotalHeight")%>:</asp:Label>
</td>
<td align="right">
<asp:Label ID="lblToplamAgirlik" runat="server" Visible="False"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="lblHacim" runat="server" Visible="False"><%=GetGlobalResourceObject("lang", "TotalVolume")%>:</asp:Label>
</td>
<td align="right">
<asp:Label ID="lblToplamHacim" runat="server" Visible="False"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="lblIndirim" runat="server" Visible="False"><%=GetGlobalResourceObject("lang", "TotalDiscount")%>:</asp:Label>
</td>
<td align="right">
<asp:Label ID="lblToplamIndirim" runat="server" Visible="False"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="Label2" runat="server"><%=GetGlobalResourceObject("lang", "TotalProductsPrice")%>:</asp:Label>
</td>
<td align="right">
<asp:Label ID="lblToplamTutar" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="Label6" runat="server"><%=GetGlobalResourceObject("lang", "TotalTax")%>:</asp:Label>
</td>
<td align="right">
<asp:Label ID="lblToplamKdv" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="lblAraToplam" runat="server"><%=GetGlobalResourceObject("lang", "SubTotal")%>:</asp:Label>
</td>
<td align="right">
<asp:Label ID="lblToplamAraToplam" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="lblCekTutari" runat="server" Visible="False"><%=GetGlobalResourceObject("lang", "CouponDiscount")%>:</asp:Label>
</td>
<td align="right">
<asp:Label ID="lblToplamCekTutari" runat="server" Visible="False"></asp:Label>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Label ID="lblSepetSeperator1" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="Label7" runat="server"><%=GetGlobalResourceObject("lang", "TotalWithTax")%>:</asp:Label>
</td>
<td align="right">
<asp:Label ID="lblKdvDahilToplam" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="lblHavale" runat="server"><%=GetGlobalResourceObject("lang", "TotalWithTransfer")%>:</asp:Label>
</td>
<td align="right">
<asp:Label ID="lblKdvDahilHavale" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="lblKKTek" runat="server"><%=GetGlobalResourceObject("lang", "TotalWithCreditCart")%>:</asp:Label>
</td>
<td align="right">
<asp:Label ID="lblKdvDahilKK" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Label ID="lblSepetSeperator2" runat="server"></asp:Label>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td align="right">
<table id="Table6" cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td id="Td7" runat="server">
</td>
<td id="Td8" runat="server">
</td>
<td id="Td9" runat="server">
</td>
</tr>
</table>
<table cellpadding="0">
<tr>
<td>
<asp:LinkButton ID="btnMailOrder" CssClass="button" runat="server" Visible="False"><%=GetGlobalResourceObject("lang", "Buy")%></asp:LinkButton>
</td>
<td>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<div id="cartalert" visible="false" runat="server" class="alert">
<asp:Label ID="lblcartError" runat="Server" EnableViewState="False"></asp:Label></div>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
Why you are attaching the events in the code behind?
Try change this line:
<asp:LinkButton ID="lnkDeleteCart" CssClass="deletebutton" runat="server"><%=GetGlobalResourceObject("lang", "Delete")%></asp:LinkButton>
To this:
<asp:LinkButton ID="lnkDeleteCart" CssClass="deletebutton" runat="server" OnClick="lnkDelete_Click"><%=GetGlobalResourceObject("lang", "Delete")%></asp:LinkButton>
And comment these lines on your code-behind:
EventHandler handler = new EventHandler(this.lnkDelete_Click);
if (this.lnkDelete != null)
{
this.lnkDelete.Click -= handler;
}
if (this.lnkDelete != null)
{
this.lnkDelete.Click += handler;
}
I made the change only on the delete button, you probably need to change others too ...
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