Step 1:
We will use ajaxtoolkit to open a new form on gridview button click or on normal button click.
You have to add reference to AjaxToolKit.dll, which you can found in the package of ajaxtoolkit from ajaxcontroltoolkit.codeplex.com.
Step 2:
You can also add Ajax tools into the asp.net toolbox, and then you can directly use its control from there, or you can hard-code.
First, Register the DLL if you are preferring hard-code.
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
on design.aspx
<style
type="text/css">
.tableBackground
{
background-color:silver;
opacity:0.7;
}
</style>
<asp:ToolkitScriptManager
ID="ScriptManager1"
runat="server"></asp:ToolkitScriptManager>
<asp:GridView
ID="grdView"
runat="server"
AutoGenerateColumns="False"
onrowcommand="grdView_RowCommand">
<Columns>
<asp:TemplateField
HeaderText="Emp
Id">
<ItemTemplate>
<asp:Label
ID="lblEmpId"
runat="server"
Text='<%#Eval("empId")
%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField
HeaderText="Generate
Salary">
<ItemTemplate>
<asp:LinkButton
ID="btnGenerateSalary"
runat="server"
Text="Generate
Salary"
CssClass="btn
btn-info"
CommandArgument='<%#Eval("empId")
%>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Button
ID="modelPopup"
runat="server"
style="display:none"
/>
<asp:ModalPopupExtender
ID="ModalPopupExtender1"
runat="server"
TargetControlID="modelPopup"
PopupControlID="updatePanel"
CancelControlID="btnCancel"
BackgroundCssClass="tableBackground">
</asp:ModalPopupExtender>
<asp:Panel
ID="updatePanel"
runat="server"
BackColor="White"
style="display:none">
<div>
<span
>Gross
Salary</span>
<asp:Label
ID="lblGrossSalary"
runat="server"></asp:Label>
</div>
<asp:Button
ID="btnCancel"
runat="server"
Text="Close"
/>
</asp:Panel>
The modalPopExtender will open the panel as a popup form :
on.cs
protected
void
grdView_RowCommand(object
sender, GridViewCommandEventArgs
e)
{
string
empId = e.CommandArgument.ToString();
this.ModalPopupExtender1.Show();
}
//You can do any implementation here with the help of the empId, or any value that you will pass as commandargument.
No comments:
Post a Comment