Code For Default.aspx Page
<%@ Page Language="C#" EnableEventValidation="false" MasterPageFile="~/MasterPage_Realestate.master" AutoEventWireup="true" CodeFile="UserManager.aspx.cs" Inherits="Default2" Title="Untitled Page" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ContentPlaceHolderID="head" ID="hhhh" runat="server">
<style type="text/css" >
.modalPopup
{
background-color:#ffffdd;
border-width:3px;
border-style:solid;
border-color:Gray;
padding:3px;
width:250px;
}
</style>
<script type="text/javascript">
function fnClickUpdate(sender, e)
{
__doPostBack(sender,e);
}
</script>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<asp1:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
</asp1:ScriptManagerProxy>
<table>
<tr>
<td style="width: 111px; height: 26px">
<asp:LinkButton ID="LinkButton1" runat="server" Font-Size="14pt" Height="23px" OnClick="LinkButton1_Click"
Width="190px" Font-Bold="True" ForeColor="ActiveCaption">View User</asp:LinkButton></td>
<td style="width: 96px; height: 26px" align="left" valign="top">
</td>
</tr>
<tr>
<td colspan="2" style="height: 18px ; " align="left" valign="top">
<asp1:UpdatePanel id="UpdatePanel1" runat="server">
<contenttemplate>
<table style="width: 100%">
<tr>
<td style="width: 100px">
<asp:Label ID="lbl_msg" runat="server" ForeColor="ActiveCaption" Width="622px" Height="21px" Font-Bold="True"></asp:Label></td>
<td style="width: 100px">
<asp:Label ID="Label2" runat="server" Height="21px" Text="Label" Width="140px" Font-Bold="True" Font-Size="14pt" ForeColor="Maroon" Visible="False"></asp:Label></td>
</tr>
</table>
<asp:Panel ID="Panel2" runat="server" Height="350px" Width="800px"
ScrollBars="Horizontal">
<asp:GridView ID="GridView_viewUser" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellPadding="3" ForeColor="#333333" GridLines="None" Height="380px" Width="798px"
BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" PageSize="20" CellSpacing="3" OnSelectedIndexChanging="GridView_viewUser_SelectedIndexChanging">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<EditRowStyle BackColor="Silver" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="LightGray" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:LinkButton ID="Lbtndelete" runat="server" Text="Delete" Width="45" Height="20" Font-Bold="true" Font-Size="Small" CommandName="Delete" ForeColor="maroon"
OnClientClick="javascript :return confirm('Are you sure ,you want to delete selected records ?');" OnClick="Lbtndelete_Click" ></asp:LinkButton>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="ckboxviewuser" runat="server" TextAlign="Left" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Action">
<ItemTemplate>
/*Model Popup For Link Button*/
<asp:LinkButton ID="lbtnedit" runat="server" CommandName="Select" Text="Edit" Width="43px" Font-Bold="True" Font-Size="10pt" Height="18px" ForeColor="Navy" OnClick="lbtnedit_Click" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"UserID").ToString()%>' ></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="User ID" Visible="False">
<ItemTemplate>
<asp:Label ID="lbluserid" runat="server" Text='<%#Eval("UserID")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField >
<asp:TemplateField HeaderText="User Name">
<ItemTemplate>
<asp:Label ID="lblName" runat="server" Text='<%#Eval("Name")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="UserType">
<ItemTemplate>
<asp:Label ID="lblUserType" runat="server" Text='<%#Eval("UserType")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
/*Model POPup */
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnhiddden" CancelControlID="btnCancel" PopupControlID="Pnl_update">
</cc1:ModalPopupExtender>
<asp:Button ID="btnhiddden" runat="server" Text="Button" Style="display: none;background-color:#f5f5f5;" Width="84px"/>
/* model popup TargetControl */
<asp:Panel ID="Pnl_update" runat="server" Height="550px" Width="525px" CssClass="modalPopup" Style="display: none; " BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" >
<table style="width: 100%; height: 100%">
<tr>
<td style="width: 100px">
</td>
<td style="width: 100px" align="right">
<asp:Button ID="btnupdate" runat="server" BackColor="Silver" Height="25px" Text="Update"
Width="92px" OnClick="btnupdate_Click" CausesValidation="False" /></td>
<td style="width: 100px">
<asp:Button ID="btnCancel" runat="server" BackColor="Silver" Height="24px" Text="Cancel"
Width="91px" CausesValidation="False" /></td>
</tr>
</table>
</asp:Panel>
</asp:Panel></contenttemplate>
</asp1:UpdatePanel><%-- </asp:Panel>--%>
</td>
</tr>
<tr>
<td style="height: 16px" align="left" colspan="2" valign="top">
</td>
</tr>
</table>
</asp:Content>
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Collections.Specialized;
using System.Text;
public partial class Default2 : System.Web.UI.Page
{
SqlConnection con;
Connection cn = new Connection();
GetData g_viewuser = new GetData();
DataSet ds_viewuser = new DataSet();
FillDD fdd_name = new FillDD();
DataTable dt= new DataTable() ;
static int flag;
static long PopupuserId,ctryid,stateid,cityid;
//static string str_Popup;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ddl_city.Enabled = false;
BindGrid("usp_SelectUserDetail");
}
}
public void BindGrid(string Query)
{
con = cn.conn();
try
{
//if (con.State == ConnectionState.Closed)
// message("Could not connect to Server");
ds_viewuser.Clear();
ds_viewuser = g_viewuser.Getdataset(Query);
GridView_viewUser.DataSource = ds_viewuser.Tables[0];
GridView_viewUser.DataBind();
lbl_msg.Text= " Total "+ Convert.ToString(ds_viewuser.Tables[0].Rows.Count)+ " "+" User Found....";
}
finally
{
con.Close();
}
}
protected void GridView_viewUser_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
PopupuserId = Convert.ToInt64(((LinkButton)GridView_viewUser.Rows[e.NewSelectedIndex].FindControl("lbtnedit")).CommandArgument.ToString());
// Label1.Text = Convert.ToString(PopupuserId);
GetUserInfo(PopupuserId);
this.ModalPopupExtender1.Show();
}
}
0 comments:
Post a Comment