<asp:UpdatePanel ID="updtpnlacademic" runat="server">
<ContentTemplate>
<td>
<asp:GridView ID="gdvwAcademic1" runat="server" OnRowCommand="gdvwAcademic1_RowCommand" OnRowDeleting="gdvwAcademic1_RowDeleting" CellPadding="4" ForeColor="#333333" GridLines="None" Width="100%" AllowSorting="True" AutoGenerateColumns="False" HorizontalAlign="Center">
<Columns>
....Other column fields
<asp:TemplateField HeaderText="Delete" ItemStyle-HorizontalAlign="Center" ShowHeader="false">
<ItemTemplate>
<asp:ImageButton ID="imgbtnacademicdelete" CommandName="Delete" OnClick="imgbtnacademicdelete_Click" CommandArgument='<%# ((GridViewRow)Container).RowIndex %>' ToolTip="Delete" runat="server" ImageAlign="Top" ImageUrl="~/Images/delete.png" Width="30" Height="25"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Button ID="btndummy" runat="server" Visible="false" />
<cc1:ModalPopupExtender ID="mpacademic" runat="server" TargetControlID="btndummy" PopupControlID="Panel2" CancelControlID="btnacademicClose" BackgroundCssClass="modalBackground">
</cc1:ModalPopupExtender>
<asp:Panel ID="Panel2" runat="server" CssClass="modalPopup" HorizontalAlign="Center" style = "display:none">
<span style="color:white; font-family:'Bookman Old Style'; font-weight:bold;">Really Want To Delete This Record...!</span><br /><br /><br /><br />
<asp:Button ID="btnconfirmacademicdelete" OnClick="btnconfirmacademicdelete_Click" CssClass="BStyle" Font-Bold="true" runat="server" Text="Yes" />
<asp:Button ID="btnacademicClose" Font-Bold="true" runat="server" CssClass="BStyle" Text="Cancel" />
</asp:Panel>
</td>
</ContentTemplate>
</asp:UpdatePanel>
And following code as in the code behind ....
protected void gdvwAcademic1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
mpacademic.Show();
//System.Windows.Forms.MessageBox.Show("RowDeleting clicked after this modal popup should be displayed.....!");
}
It only show messagebox on event if uncomment messagebox but not showing modal popup
<cc1:ModalPopupExtender ID="mpacademic" runat="server" TargetControlID="btndummy" PopupControlID="Panel2" CancelControlID="btnacademicClose" BackgroundCssClass="modalBackground">
</cc1:ModalPopupExtender>
The TargetControlID property is set to btndummy and
<asp:Button ID="btndummy" runat="server" Visible="false" />
btndummy is not rendering since Visible property is set to false.
Try to replace
<asp:Button ID="btndummy" runat="server" Visible="false" />
With
<asp:Button ID="btndummy" runat="server" style="display:none" />
Related
I have an update panel that includes a gridview with two buttons and a modal popup. When the user clicks btnView, the modal popup appears displaying the relevant information.
My issue is that I have been trying to get the updateprogress to appear during the partial postback and so far have not managed it. I should mention that the same UpdateProgress code does work in a test page that just comprises of a button with a sleep function in the code behind. Here is the html:
<!-- Placing the GridView in UpdatePanel-->
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="gv" />
</Triggers>
<ContentTemplate>
<asp:GridView ID="gv" runat="server" AutoGenerateColumns="False" DataKeyNames="GroupID" GridLines="Both"
BorderWidth="1px" CellPadding="2" ForeColor="Black" OnRowDataBound="gv_RowDataBound" BorderStyle="Double" HorizontalAlign="Center"
HeaderStyle-HorizontalAlign="Center" AllowSorting="True" CssClass="gvformat">
<AlternatingRowStyle BackColor="#95B9B9" />
<HeaderStyle BorderStyle="Double" BorderColor="Black"/>
<Columns>
<asp:BoundField DataField="FinancialYear" HeaderText="Financial Year" ItemStyle-HorizontalAlign="Center"/>
<asp:TemplateField ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Button ID="btnView" runat="server" Text="view" OnClick="btnComments_Click" CausesValidation="false" Font-Names="Trebuchet MS" CssClass="btn btn-info" Font-Bold="True" />
</ItemTemplate>
<HeaderTemplate>Comment</HeaderTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle">
<ItemTemplate>
<asp:Button ID="btnDetail" runat="server" Text="view" OnClick="btnDetails_Click" CausesValidation="false" Font-Names="Trebuchet MS" CssClass="btn btn-comment" ForeColor="White" Font-Bold="True" />
</ItemTemplate>
<HeaderTemplate>Details</HeaderTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Button ID="bttnHidden" runat="Server" Style="display: none" />
<br />
<asp:Panel ID="pnlComment" runat="server" Width="650px" Height="620px" Style="display: none;" CssClass="modalBox">
<table border="1" class="commentTable" style="border-collapse: separate; border-spacing: 10px; width:100%; height:100%">
<tr><th><asp:Label ID="lblComments" runat="server" Text="Comments" Font-Size="Medium"></asp:Label></th></tr>
<tr><td>
<asp:TextBox ID="txtExistingComments" runat="server" TextMode="MultiLine" ReadOnly="True" CssClass="content" Rows="12" Font-Names="Trebuchet MS"></asp:TextBox>
</td></tr>
<tr><th><asp:Label ID="lblNewComment" runat="server" Text="Add Comment" Font-Size="Medium"></asp:Label></th></tr>
<tr><td>
<asp:TextBox ID="txtNewComments" runat="server" TextMode="MultiLine" ReadOnly="False" CssClass="content" Rows="12" Font-Names="Trebuchet MS"></asp:TextBox></td></tr>
<tr><td>
<asp:Button ID="btnSave" runat="server" width="100px" Text="Save" OnClick="btnSave_Click" CssClass="btn btn-comment" ValidationGroup="SaveComment" ForeColor="White" Font-Bold="True" />
<asp:Button ID="btnCancel" runat="server" width="100px" Text="Cancel" CssClass="btn btn-comment" ForeColor="White" Font-Bold="True"/></td></tr>
<tr>
<td>
<asp:RequiredFieldValidator ID="rfValidator" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="txtNewComments"
ForeColor="Black" ValidationGroup="SaveComment" Font-Bold="True">You must enter a comment!</asp:RequiredFieldValidator>
</td>
</tr>
</table>
</asp:Panel>
<cc1:ModalPopupExtender ID="modal" runat="server" TargetControlID="bttnHidden" PopupControlID="pnlComment" CancelControlID="btnCancel" BackgroundCssClass="modalBackground"></cc1:ModalPopupExtender>
<br />
<asp:HiddenField ID="Hidden" runat="server" value="-1"/>
<asp:HiddenField ID="bStatus" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1" ChildrenAsTriggers="false" UpdateMode="Conditional" DisplayAfter="10">
<ProgressTemplate>
<div class="center">
<asp:Image ID="imgUpdateProgress" runat="server" ImageUrl="~/Images/loader.gif" AlternateText="Please wait ..." ToolTip="Please wait ..." />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
</asp:Content>
Any help would be most appreciated!
two points you need to check.
First if you have any javascript errors - this Update Progress is base on javascrip, so any javascript error can stop the function of it. Open the console panel and check for javascript errors...
The second point is to check the DisplayAfter property on UpdateProgress, that is 500 milliseconds default value. If anything happens within this time, the UpdateProgress is not show. So add a lower value on DisplayAfter to check it out.
i have some imagebuttons in GridView and when i clicked those image buttons whole page is refreshed. i just want to fire that image button event when i click to that imagebutton without reloading whole page. i have also used updatepanel.
i am facing this problem from two days now i need help i thing i cant do this.
this is my .aspx
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" ></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="updatebutton" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:ImageButton ID="updatebutton" runat="server" Visible="false" OnPreRender="ImageButton_PreRender" OnClick="ImageButton_Click" />
<asp:GridView ID="gvSeatLayout" runat="server" AutoGenerateColumns="False" Width="755px" AllowPaging="True"
OnRowDataBound="gvSeatLayout_RowDataBound" OnRowCreated="gvSeatLayout_RowCreated"
PageSize="25" ShowHeader="False" CellSpacing="0" CellPadding="5" BorderStyle="None" >
<RowStyle CssClass="gvspace" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table>
<tr><td>
<asp:LinkButton ID="LinkButton1" Enabled="false" Font-Bold="true" ForeColor="White" CommandName="lbtnRowId" CommandArgument='<%# Eval("RowId") %>' Text='<%# RowName(Eval("RowName").ToString()) %>' runat="server"></asp:LinkButton>
</td>
</tr>
<td></td></table>
</ItemTemplate>
<ItemStyle BorderStyle="None" />
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" CssClass="ss" OnClick="ImageButton_Click" CommandArgument='<%# Eval("L1") %>' CommandName="ib1" runat="server" ImageUrl='<%# MyUrl(Eval("L1").ToString(),Eval("RowId").ToString()) %>' />
<asp:PopupControlExtender ID="PopupControlExtender1" runat="server" popupcontrolid="Panel1"
targetcontrolid="ImageButton1" dynamiccontextkey='<%# Eval("L1") %>' dynamiccontrolid="Panel1"
dynamicservicemethod="GetDynamicContent" position="Bottom">
</asp:PopupControlExtender>
</ItemTemplate>
<ItemStyle BorderStyle="None" />
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="ImageButton3" runat="server" CssClass="ss" OnClick="ImageButton_Click" CommandArgument='<%# Eval("L3") %>' CommandName="ib3" ImageUrl='<%# MyUrl(Eval("L3").ToString(),Eval("RowId").ToString()) %>'/>
<asp:PopupControlExtender ID="PopupControlExtender2" runat="server" popupcontrolid="Panel1"
targetcontrolid="ImageButton3" dynamiccontextkey='<%# Eval("L3") %>' dynamiccontrolid="Panel1"
dynamicservicemethod="GetDynamicContent" position="Bottom">
</asp:PopupControlExtender>
</ItemTemplate>
<ItemStyle BorderStyle="None" />
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="ImageButton4" runat="server" CssClass="ss" OnClick="ImageButton_Click" CommandArgument='<%# Eval("L4") %>' CommandName="ib4" ImageUrl='<%# MyUrl(Eval("L4").ToString(),Eval("RowId").ToString()) %>'/>
<asp:PopupControlExtender ID="PopupControlExtender3" runat="server" popupcontrolid="Panel1"
targetcontrolid="ImageButton4" dynamiccontextkey='<%# Eval("L4") %>' dynamiccontrolid="Panel1"
dynamicservicemethod="GetDynamicContent" position="Bottom">
</asp:PopupControlExtender>
</ItemTemplate>
<ItemStyle BorderStyle="None" />
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="ImageButton8" runat="server" CssClass="ss" OnClick="ImageButton_Click" CommandArgument='<%# Eval("U1") %>' CommandName="ib8" ImageUrl='<%# MyUrl(Eval("U1").ToString(),Eval("RowId").ToString()) %>'/>
<asp:PopupControlExtender ID="PopupControlExtender4" runat="server" popupcontrolid="Panel1"
targetcontrolid="ImageButton8" dynamiccontextkey='<%# Eval("U1") %>' dynamiccontrolid="Panel1"
dynamicservicemethod="GetDynamicContent" position="Bottom">
</asp:PopupControlExtender>
</ItemTemplate>
<ItemStyle BorderStyle="None" />
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="ImageButton10" runat="server" CssClass="ss" OnClick="ImageButton_Click" CommandArgument='<%# Eval("U3") %>' CommandName="ib10" ImageUrl='<%# MyUrl(Eval("U3").ToString(),Eval("RowId").ToString()) %>'/>
<asp:PopupControlExtender ID="PopupControlExtender5" runat="server" popupcontrolid="Panel1"
targetcontrolid="ImageButton10" dynamiccontextkey='<%# Eval("U3") %>' dynamiccontrolid="Panel1"
dynamicservicemethod="GetDynamicContent" position="Bottom">
</asp:PopupControlExtender>
</ItemTemplate>
<ItemStyle BorderStyle="None" />
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="ImageButton11" runat="server" CssClass="ss" OnClick="ImageButton_Click" CommandArgument='<%# Eval("U4") %>' CommandName="ib10"
ImageUrl='<%# MyUrl(Eval("U4").ToString(),Eval("RowId").ToString()) %>'/>
<asp:PopupControlExtender ID="PopupControlExtender6" runat="server" popupcontrolid="Panel1"
targetcontrolid="ImageButton11" dynamiccontextkey='<%# Eval("U4") %>' dynamiccontrolid="Panel1"
dynamicservicemethod="GetDynamicContent" position="Bottom">
</asp:PopupControlExtender>
</ItemTemplate>
<ItemStyle BorderStyle="None" />
</asp:TemplateField>
</Columns>
<FooterStyle BorderStyle="None" />
<SelectedRowStyle BorderStyle="None" />
<EditRowStyle BorderStyle="None" />
<AlternatingRowStyle BorderStyle="None" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
Try change the update mode to "Always". At the moment, the Async method is tied with the "updatebutton".
Try to place the triggers tag after the content template end tag like this...
...</ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="updatebutton" EventName="Click" /> </Triggers>
I'm trying to use the events on my Gridview control. But its not firing the events when expected. i.e, for OnSelectedIndexChanged, when changing the selected cell/row nothing happens. I've tried with OnSelectedIndexChanged as well as OnRowUpdating. The breakpoint is never hit in gvQ15_RowUpdating. I've even tried using the OnTextChanged event for the child textboxes or the gridview and they are not firing.
Markup
<asp:GridView AutoPostBack="true" ID="gvQ15" runat="server" AllowPaging="false" AutoGenerateColumns="false" >
<Columns>
<asp:TemplateField HeaderText="Prescription Medication Name" ItemStyle-Width="25%">
<ItemTemplate>
<asp:TextBox ID="txtPrescriptionMedicationName" runat="server" Width="100%" OnTextChanged="txtPrescriptionMedicationName_TextChanged" BordewWidth="0" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Date Originally Prescribed" ItemStyle-Width="10%">
<ItemTemplate>
<asp:TextBox ID="txtDateOriginallyPrescribed" runat="server" Style="min-width: 110px; width: 100%;" BorderWidth="0" OnTextChanged="txtDateOriginallyPrescribed_TextChanged" />
<asp:MaskedEditExtender ID="meetxtDateOriginallyPrescribed" runat="server" MaskType="date" UserDateFormat="MonthDayYear" Mask="99/99/9999" TargetControlID="txtDateOriginallyPrescribed" ClearMaskOnLostFocus="true" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Frequency and Dosage" ItemStyle-Width="25%">
<ItemTemplate>
<asp:TextBox ID="txtFrequencyAndDosage" runat="server" Width="100%" BorderWidth="0" OnTextChanged="txtFrequencyAndDosage_TextChanged" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Condition" ItemStyle-Width="25%">
<ItemTemplate>
<asp:TextBox ID="txtCondition" runat="server" Width="100%" BorderWidth="0" OnTextChanged="txtCondition_TextChanged" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Onset Date" ItemStyle-Width="10%">
<ItemTemplate>
<asp:TextBox ID="txtConditionOnsetDate" runat="server" style="min-width:110px;width:100%" BorderWidth="0" OnTextChanged="txtConditionOnsetDate_TextChanged" />
<asp:MaskedEditExtender ID="meeConditionOnsetDate" runat="server" MaskType="date" UserDateFormat="MonthDayYear" Mask="99/99/9999" TargetControlID="txtConditionOnsetDate" ClearMaskOnLostFocus="true" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Code Behind
Protected Sub gvQ15_RowUpdating(sender As Object, e As GridViewUpdateEventArgs)
Session("Prescriptions") = gvQ15.DataSource
End Sub
Add the CausesValidation="False" attribute to your CommandField.
<asp:commandfield ShowEditButton="True" CausesValidation="False" HeaderText="Edit"/>
Or,
Add the EnableViewState="True" attribute to your GridView.
For TemplateField use this:
<asp:TemplateField HeaderText="Command">
<ItemTemplate>
<asp:Button CommandName="Edit" Text="Edit" ID="btnEdit" Runat="server"></asp:Button>
<asp:Button CommandName="Delete" Text="Delete" ID="btnDel" Runat="server"></asp:Button>
</ItemTemplate>
<EditItemTemplate>
<asp:Button CommandName="Update" Text="Update" ID="btnUpdate" Runat="server"></asp:Button>
<asp:Button CommandName="Cancel" Text="Delete" ID="btnCancel" Runat="server"></asp:Button>
</EditItemTemplate>
</asp:TemplateField>
I have an ADD button in my FormView in ASP.NET. And I have txtName on it that should first check if the textbox is empty. If it was empty, the ADD button should message Please fill up the form.
I tried the traditional error handling in vb.net like
If txtbox.text = "" then
error msg
end if
but it is not applicable when making a web page using ASP.NET backend: VBNET.
<asp:FormView ID="FormView1" runat="server" DataKeyNames="ID" DataSourceID="SqlDataSource1" Height="92px" Width="835px" AllowPaging="True" CellPadding="3" DefaultMode="Insert" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" GridLines="Horizontal" BackImageUrl= "howto.jpg" style="margin-bottom: 12px">
<EditRowStyle BackColor="#738A9C" BorderStyle="Solid" Font-Bold="True" ForeColor="#F7F7F7" />
<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<InsertItemTemplate>
<asp:Label ID="lblName" runat="server" Text="Name of Applicant" Font-Size ="10pt" Font-Names="Arial" ></asp:Label>
<asp:Label ID="lblBday" runat="server" Font-Names="Arial" Font-Size="10pt" Text="Birthday"></asp:Label>
<asp:Label ID="Gender" runat="server" Font-Names="Arial" Font-Size="10pt" Text="Gender"></asp:Label>
<br />
<asp:TextBox ID="txtName" runat="server" Height="19px" Text='<%# Bind("Name") %>' Width="216px" Font-Size ="10" Font-Names="Arial"></asp:TextBox>
<asp:TextBox ID="txtBday" runat="server" Font-Names="Arial" Font-Size="10pt" Height="19px" Text='<%# Bind("Birthday") %>' TextMode="Date" Width="216px"></asp:TextBox>
<asp:DropDownList ID="txtGender" runat="server" Height="19px" Width="222px" SelectedValue='<%# Bind("Gender") %>'>
<asp:ListItem>Male</asp:ListItem>
<asp:ListItem>Female</asp:ListItem>
</asp:DropDownList>
<br />
<br />
<asp:Label ID="lblAddress" runat="server" Font-Names="Arial" Font-Size="10pt" Text="Address"></asp:Label>
<asp:Label ID="lblContact" runat="server" Font-Names="Arial" Font-Size="10pt" Text="Contact"></asp:Label>
<br />
<asp:TextBox ID="txtAddress" runat="server" Font-Names="Arial" Font-Size="10pt" Height="19px" Text='<%# Bind("Address") %>' Width="488px"></asp:TextBox>
<asp:TextBox ID="txtContact" runat="server" Font-Names="Arial" Font-Size="10pt" Height="19px" Text='<%# Bind("Contact") %>' Width="216px"></asp:TextBox>
<br />
<br />
<br />
<asp:Label ID="lblEduc" runat="server" Font-Names="Arial" Font-Size="10pt" Text="Educational Attainment"></asp:Label>
<asp:Label ID="lblCourse" runat="server" Font-Names="Arial" Font-Size="10pt" Text="Course"></asp:Label>
<br />
<asp:DropDownList ID="txtEduc" runat="server" Height="19px" SelectedValue='<%# Bind("Education") %>' Width="495px">
<asp:ListItem>High School</asp:ListItem>
<asp:ListItem>College Diploma (2-3 years)</asp:ListItem>
<asp:ListItem>College Undergrad (4-5 years)</asp:ListItem>
<asp:ListItem>Bachelor's Degree</asp:ListItem>
<asp:ListItem Value="Master">Masteral</asp:ListItem>
<asp:ListItem>Doctor</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="txtCourse" runat="server" Font-Names="Arial" Font-Size="10pt" Height="19px" Text='<%# Bind("Course") %>' Width="216px"></asp:TextBox>
<br />
<br />
<br />
<asp:Button ID="btnAdd" runat="server" Text="ADD" Font-Bold="True" Font-Size="Medium" ForeColor="Black" BorderColor="Black" BorderStyle="Solid" BorderWidth="2px" CausesValidation="True" ValidationGroup="Insert" Font-Names="Berlin Sans FB Demi" CommandName="Insert" />
<asp:Button ID="btnCancel" runat="server" Text="CANCEL" Font-Bold="True" Font-Names="Berlin Sans FB Demi" Font-Size="Medium" ForeColor="Black" BorderColor="Black" BorderStyle="Solid" BorderWidth="2px" CommandName="Cancel" />
</InsertItemTemplate>
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
</asp:FormView>
You can't show that alert on a webapp, but you can use javascript in order to do it.
In code behind declare this function:
Public Sub AlertMessage(ByVal mensaje As String, ByVal pag As Page)
pag.ClientScript.RegisterStartupScript(Me.GetType(), "showConfirm", "Alerta('" & mensaje & "');", True)
End Sub
Then call it from your ADD button like this:
If txtbox.text = "" then
AlertMessage(msg, Me.Page)
end if
Hope this helps
I've learn from some research that there is other way for error handling using ASPNET. I used the validation control and validation group.
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ValidationGroup ="FillUp" runat="server" ControlToValidate ="txtName" ErrorMessage="Please Enter Your Name"></asp:RequiredFieldValidator><br />
<asp:Button ID="btnAdd" runat="server" Text="ADD" Font-Bold="True" Font-Size="Medium" ForeColor="Black" BorderColor="Black" BorderStyle="Solid" BorderWidth="2px" CausesValidation="True" ValidationGroup="FillUp" Font-Names="Berlin Sans FB Demi" CommandName="Insert" />
enter image description here
I also add this code in my Web.config
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
</appSettings>
I know, what you are thinking,"This guy has a poor desig", lol, well the important is you know the code xD
I have a gridview and i have two buttons edit and delete.Once i click on edit button, i take the values and put those in textboxes outside grid and visible update and cancel button. but that does not fires..
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:Panel ID="pnladdproduct" runat="server">
<div class="mws-form-col-1-8">
<asp:Label ID="Label11" runat="server" AssociatedControlID="btnAddProduct"> </asp:Label>
<div class="mws-form-item large">
<asp:Button ID="btnAddProduct" ValidationGroup="grpProduct" runat="server" CssClass="mws-button red" Text="Add" OnClick="btnAddProduct_Click" />
</div>
</div>
</asp:Panel>
<asp:Panel ID="pnlUpdateProduct" runat="server">
<div class="mws-form-col-1-8">
<asp:Label ID="Label12" runat="server" AssociatedControlID="btnUpdateProduct"> </asp:Label>
<div class="mws-form-item large">
<asp:Button ID="btnUpdateProduct" runat="server" CausesValidation="False" CssClass="mws-button blue" Text="Update" OnClick="btnUpdateProduct_Click" />
</div>
</div>
</asp:Panel>
<asp:Panel ID="pnlCancel" runat="server">
<div class="mws-form-col-1-8">
<asp:Label ID="Label13" runat="server" AssociatedControlID="btnCancelUpdate"> </asp:Label>
<div class="mws-form-item large">
<asp:Button ID="btnCancelUpdate" CausesValidation="False" runat="server" CssClass="mws-button gray" Text="Cancel" OnClick="btnCancelUpdate_Click" />
</div>
</div>
</asp:Panel>
<div class="mws-form-col-8-8">
<asp:GridView ID="grdProduct" ShowHeaderWhenEmpty="True" CssClass="mGrid" runat="server" AutoGenerateColumns="False" AllowPaging="True" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt" OnPageIndexChanging="grdProduct_PageIndexChanging" OnRowDeleting="grdProduct_RowDeleting" OnRowEditing="grdProduct_RowEditing">
<Columns>
<asp:BoundField DataField="Name" HeaderText="Product" SortExpression="Product" />
<asp:BoundField DataField="Quantity" HeaderText="Quantity" SortExpression="Quantity" />
<asp:BoundField DataField="Rate" HeaderText="Rate" SortExpression="Rate" />
<asp:BoundField DataField="Amount" HeaderText="Amount" SortExpression="Amount" />
<asp:ButtonField ButtonType="Image" CommandName="Edit" HeaderText="Edit" ImageUrl="~/css/icons/16/edit.png" ShowHeader="True" Text="Edit" />
<asp:ButtonField ButtonType="Image" CommandName="Delete" HeaderText="Delete" ImageUrl="~/css/icons/16/delete.png" ShowHeader="True" Text="Delete" />
<asp:TemplateField HeaderText="HiddenColumn">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<asp:HiddenField ID="hdfProductID" runat="server" Value='<%# Bind("ProID") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
No Products Added !!
</EmptyDataTemplate>
</asp:GridView>
<div class="mws-form-row inline">
<asp:Label ID="Label15" runat="server" AssociatedControlID="txtQuantity">Total Amount</asp:Label>
<div class="mws-form-item medium">
<asp:TextBox ID="txtTotalAmount" BackColor="Beige" BorderColor="red" ReadOnly="True" CssClass="mws-textinput" runat="server"></asp:TextBox>
</div>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnUpdateProduct" EventName="Click"/>
<asp:PostBackTrigger ControlID="btnCancelUpdate" />
</Triggers>
</asp:UpdatePanel>
Server side Code..
protected void grdProduct_RowEditing(object sender, GridViewEditEventArgs e)
{
Session["proID"] = StepGetHiddenValuesFromGridControl(e.NewEditIndex);
txtQuantity.Text = grdProduct.Rows[e.NewEditIndex].Cells[1].Text;
txtRate.Text = grdProduct.Rows[e.NewEditIndex].Cells[2].Text;
txtAmount.Text = grdProduct.Rows[e.NewEditIndex].Cells[3].Text;
txtQuantity.BackColor = Color.Beige;
txtRate.BackColor = Color.Beige;
txtAmount.BackColor = Color.Beige;
//pnladdproduct.Visible = false;
//pnlUpdateProduct.Visible = true;
//pnlCancel.Visible = true;
}
protected void btnUpdateProduct_Click(object sender, EventArgs e)
{
// this code not firing
}
I don't think there's a need for triggers.