Hello All,
I want to create new pop window like this site have while login. How can I do this?
Thanking you,
Hakoo Desai.
you can try Ajax extender for modalPopUp is asp.net...
try this link.....http://www.asp.net/ajax/ajaxcontroltoolkit/samples/modalpopup/modalpopup.aspx
Hello,
We tried to use this extender and googled with so many examples but none of that are working. Here, I am putting my snapshot of sample code,
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.modal {
background-color:Gray;
filter:alpha(opacity=70);
opacity:0.7;
}
.modalPopup {
background-color:#EEEEEE;
border-width:3px;
border-style:solid;
border-color:Gray;
font-family:Verdana;
font-size:medium;
padding:3px;
width:250px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
BackgroundCssClass="modal" DropShadow="True" PopupControlID="Panel1"
TargetControlID="lnk" CacheDynamicResults="True">
</asp:ModalPopupExtender>
<asp:LinkButton ID="lnk" runat="server">LinkButton</asp:LinkButton>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Panel ID="Panel1" CssClass="modalPopup" runat="server">
doihglkjosaklnglknqeoivgoiwr;ctwrgrg</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
Thanking you,
Hakoo Desai.
hi Hakoo, try this:-
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.modalBackground
{
background-color: Gray;
filter: alpha(opacity=80);
opacity: 0.8;
z-index: 10000;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<div>
<asp:GridView runat="server" ID="gvdetails" DataKeyNames="UserId" AutoGenerateColumns="false">
<RowStyle BackColor="#EFF3FB" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:TemplateField HeaderText="Edit">
<ItemTemplate>
<asp:ImageButton ID="imgbtn" ImageUrl="~/Edit.jpg" runat="server" Width="25" Height="25" onclick="imgbtn_Click" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="UserName" HeaderText="UserName" />
<asp:BoundField DataField="FirstName" HeaderText="FirstName" />
<asp:BoundField DataField="LastName" HeaderText="LastName" />
<asp:BoundField DataField="City" HeaderText="City" />
<asp:BoundField DataField="Designation" HeaderText="Designation" />
</Columns>
</asp:GridView>
<asp:Label ID="lblresult" runat="server"/>
<asp:Button ID="btnShowPopup" runat="server" style="display:none" />
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnShowPopup" PopupControlID="pnlpopup"
CancelControlID="btnCancel" BackgroundCssClass="modalBackground">
</asp:ModalPopupExtender>
<asp:Panel ID="pnlpopup" runat="server" BackColor="White" Height="269px" Width="400px" style="display:none">
<table width="100%" style="border:Solid 3px #D55500; width:100%; height:100%" cellpadding="0" cellspacing="0">
<tr style="background-color:#D55500">
<td colspan="2" style=" height:10%; color:White; font-weight:bold; font-size:larger" align="center">User Details</td>
</tr>
<tr>
<td align="right" style=" width:45%">
UserId:
</td>
<td>
<asp:Label ID="lblID" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
UserName:
</td>
<td>
<asp:Label ID="lblusername" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
FirstName:
</td>
<td>
<asp:TextBox ID="txtfname" runat="server"/>
</td>
</tr>
<tr>
<td align="right">
LastName:
</td>
<td>
<asp:TextBox ID="txtlname" runat="server"/>
</td>
</tr>
<tr>
<td align="right">
City:
</td>
<td>
<asp:TextBox ID="txtCity" runat="server"/>
</td>
</tr>
<tr>
<td align="right">
Designation:
</td>
<td>
<asp:TextBox ID="txtDesg" runat="server"/>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Button ID="btnUpdate" CommandName="Update" runat="server" Text="Update" onclick="btnUpdate_Click"/>
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</td>
</tr>
</table>
</asp:Panel>
</div>
</form>
</body>
</html>
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["dbconnection"].ToString());
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
BindGridData();
}
}
protected void BindGridData()
{
con.Open();
SqlCommand cmd = new SqlCommand("Select * from Employee_Details", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
gvdetails.DataSource = dt;
gvdetails.DataBind();
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("update Employee_Details set FirstName=@FirstName,LastName=@LastName, City=@City,Designation=@Designation where UserId=@UserId", con);
cmd.Parameters.AddWithValue("@FirstName", txtfname.Text);
cmd.Parameters.AddWithValue("@LastName", txtlname.Text);
cmd.Parameters.AddWithValue("@City", txtCity.Text);
cmd.Parameters.AddWithValue("@Designation", txtDesg.Text);
cmd.Parameters.AddWithValue("@UserId", Convert.ToInt32(lblID.Text));
cmd.ExecuteNonQuery();
con.Close();
lblresult.Text = lblusername.Text + " Details Updated Successfully";
lblresult.ForeColor = Color.Green;
BindGridData();
}
protected void imgbtn_Click(object sender, ImageClickEventArgs e)
{
ImageButton btndetails = sender as ImageButton;
GridViewRow gvrow = (GridViewRow)btndetails.NamingContainer;
lblID.Text = gvdetails.DataKeys[gvrow.RowIndex].Value.ToString();
lblusername.Text = gvrow.Cells[1].Text;
txtfname.Text = gvrow.Cells[2].Text;
txtlname.Text = gvrow.Cells[3].Text;
txtCity.Text = gvrow.Cells[4].Text;
txtDesg.Text = gvrow.Cells[5].Text;
this.ModalPopupExtender1.Show();
}
Hello Pinkygirl,
Thanks for your code. But I am more interested to find error in my code. Is there any restriction on PopupControlID and TargetControlID? I mean, only limited controls can be given as ID? I have seen example where PopupControlID is Panel and TargetControlID is Button. But those are not working for me.
Anyways, I will try your code and let u know.
Thanking You,
Hakoo Desai.
Hey Hakoo, I haven't tried modal pop up before. It's because I have the latest version of ajax and my ms visual studio is of 2005, so it won't work.
I got these codes from the internet.
Hope it helps
:) Take care
Yup, This code is working.
Thanks.
For your solution, you can get old ajax version from its site.
No problem, I tried searching but i aint getting it. My sir won't even give me..
Hello All,
I want to create new pop window like this site have while login. How can I do this?
Thanking you,
Hakoo Desai.
window.open ("http://www.axistechnolabs.com","mywindow","status=1");
Hello,
@pinkygirl : see this site, http://ajaxcontroltoolkit.codeplex.com/releases/view/11121
@chrishlay : That will open new browser window, that I don't want.
wow..thanks Hakoo :)
Its my pleasure.
umm one problem,, which link should I click?
<script language="javascript" type="text/javascript">
function popwin()
{
var w=window.Open("yourpage.html",'PageTitle','toolbar=no,width=300,height=400');
w.window.focus();
}
</script>
Use this javascript code between <head> tag.Call it on button click.
use modelpopup or ajax pop up for login control popup
Hello all,
I used ModalpopupExtender. But having porblem in that. My targetID is linkbutton and PopupID is Panel. By giving this, its working fine.
But, problem is, I want show panel with some process, e.g. Manipulating rolls of login user and showing it. I put Breakpoint on lnkbtn_Click(). But it cannot be debugged only. Then, How to do this process?
In layman language, when I click to linkbutton, then some lines should execute and then related that result should be seen in Modal Popup.
Thanking You,
Hakoo S Desai.
Complete Tutorial here
http://everymanprogrammer.com/index.php/using-the-ajax-modalpopup-a-beginners-guide
i want to write any code for link button or not
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.