<center>
<asp:GridView ID="GridView1" runat="server" EmptyDataText="No Record" Style="text-align: center;
font-family: Arial, Helvetica, sans-serif; font-size: small; margin-left: 0px;"
DataKeyNames="FLATID" AutoGenerateColumns="False" Width="100%" CellPadding="4"
ForeColor="#333333" GridLines="None" AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging"
PageSize="15">
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<Columns>
<asp:TemplateField HeaderText="Select">
<HeaderTemplate>
<asp:CheckBox ID="chkSelectAll" runat="server" AutoPostBack="true" Text="Select All"
OnCheckedChanged="CheckBox1_CheckedChanged" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" AutoPostBack="true" OnCheckedChanged="chkSelect_CheckedChanged" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="" SortExpression="FLATNO">
<ItemTemplate>
<asp:HiddenField ID="pid" Value='<%# Bind("FLATID") %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Flat NO" SortExpression="FLATNO">
<EditItemTemplate>
<asp:TextBox ID="FLATNOED" runat="server" Text='<%# Bind("FLATNO") %>' Width="50px"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:TextBox ID="FLATNOIT" runat="server" Text='<%# Bind("FLATNO") %>' Enabled="false"
Width="70px" ForeColor="Black"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="BHK1" SortExpression="BHK1">
<EditItemTemplate>
<asp:RadioButton ID="BHK1ED" runat="server" Checked='<%# Bind("BHK1") %>' GroupName="a" />
</EditItemTemplate>
<ItemTemplate>
<asp:RadioButton ID="BHK1IT" runat="server" Checked='<%# Bind("BHK1") %>' Enabled="false"
GroupName="b" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="BHK2" SortExpression="BHK2">
<EditItemTemplate>
<asp:RadioButton ID="BHK2ED" runat="server" Checked='<%# Bind("BHK2") %>' GroupName="a" />
</EditItemTemplate>
<ItemTemplate>
<asp:RadioButton ID="BHK2IT" runat="server" Checked='<%# Bind("BHK2") %>' Enabled="false"
GroupName="b" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="BHK3" SortExpression="BHK3">
<EditItemTemplate>
<asp:RadioButton ID="BHK3ED" runat="server" Checked='<%# Bind("BHK3") %>' GroupName="a" />
</EditItemTemplate>
<ItemTemplate>
<asp:RadioButton ID="BHK3IT" runat="server" Checked='<%# Bind("BHK3") %>' Enabled="false"
GroupName="b" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="BHK4" SortExpression="BHK4">
<EditItemTemplate>
<asp:RadioButton ID="BHK4ED" runat="server" Checked='<%# Bind("BHK4") %>' GroupName="a" />
</EditItemTemplate>
<ItemTemplate>
<asp:RadioButton ID="BHK4IT" runat="server" Checked='<%# Bind("BHK4") %>' Enabled="false"
GroupName="b" />
</ItemTemplate>
</asp:TemplateField>
<%-- <asp:TemplateField HeaderText="BHK5" SortExpression="BHK5">
<EditItemTemplate>
<asp:RadioButton ID="VILLAED" runat="server" Checked='<%# Bind("Flat") %>' GroupName="a" />
</EditItemTemplate>
<ItemTemplate>
<asp:RadioButton ID="VILLAIT" runat="server" Checked='<%# Bind("Flat") %>' Enabled="false"
GroupName="b" />
</ItemTemplate>
</asp:TemplateField>--%>
<asp:TemplateField HeaderText="PREMIUM" SortExpression="PREMIUM">
<EditItemTemplate>
<asp:CheckBox ID="PREMIUMED" runat="server" Checked='<%# Bind("PREMIUM") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="PREMIUMIT" runat="server" Checked='<%# Bind("PREMIUM") %>' Enabled="false" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SERVENT" SortExpression="SERVENT">
<EditItemTemplate>
<asp:CheckBox ID="SERVENTED" runat="server" Checked='<%# Bind("SERVENT") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="SERVENTIT" runat="server" Checked='<%# Bind("SERVENT") %>' Enabled="false" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="FURNISHING">
<EditItemTemplate>
<asp:CheckBox ID="FURNISHING" runat="server" Checked='<%# Bind("FURNISHING") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="FURNISHING" runat="server" Checked='<%# Bind("FURNISHING") %>' Enabled="false" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="FLOOR" SortExpression="SIZE">
<EditItemTemplate>
<asp:TextBox ID="FLOORED" runat="server" Text='<%# Bind("flor") %>' Width="100px"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:TextBox ID="FLOORIT" runat="server" Text='<%# Bind("flor") %>' Enabled="false"
Width="50px" ForeColor="Black"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText=" AREA" SortExpression="SIZE">
<EditItemTemplate>
<asp:TextBox ID="AREAED" runat="server" Text='<%# Bind("SIZE") %>' Width="100px"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:TextBox ID="AREAIT" runat="server" Text='<%# Bind("SIZE") %>' Enabled="false"
Width="70px" ForeColor="Black"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="BUILT UP AREA">
<EditItemTemplate>
<asp:TextBox ID="BUILDUPAREA" runat="server" Text='<%# Bind("BUILDUPAREA") %>' Width="100px"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:TextBox ID="BUILDUPAREA" runat="server" Text='<%# Bind("BUILDUPAREA") %>' Enabled="false"
Width="100px" ForeColor="Black"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="DIMENSION" SortExpression="SIZE">
<EditItemTemplate>
<asp:TextBox ID="DIMENSIONED" runat="server" Text='<%# Bind("DIMENSION") %>' Width="100px"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:TextBox ID="DIMENSIONIT" runat="server" Text='<%# Bind("DIMENSION") %>' Enabled="false"
Width="100px" ForeColor="Black"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="REMARKS" SortExpression="SIZE">
<EditItemTemplate>
<asp:TextBox ID="REMARKSED" runat="server" Text='<%# Bind("REMARKS") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:TextBox ID="REMARKSIT" runat="server" Text='<%# Bind("REMARKS") %>' Enabled="false"
ForeColor="Black"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" Width="735PX" />
<PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="All Update" OnClick="Button1_Click"
OnClientClick="var ret=confirm('Are you sure you want to Update'); if (ret==true) return true; else return false;"
Width="150px" Visible="false" />
<br />
<br />
</center>
c#
protected void updatgrid(string str)
{
GridView1.EditIndex = -1;
data();
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataBind();
data();
}
protected void chkSelect_CheckedChanged(object sender, EventArgs e)
{
CheckBox chkTest = (CheckBox)sender;
GridViewRow grdRow = (GridViewRow)chkTest.NamingContainer;
TextBox FLATNOIT = (TextBox)grdRow.FindControl("FLATNOIT");
RadioButton BHK1IT = (RadioButton)grdRow.FindControl("BHK1IT");
RadioButton BHK2IT = (RadioButton)grdRow.FindControl("BHK2IT");
RadioButton BHK3IT = (RadioButton)grdRow.FindControl("BHK3IT");
RadioButton BHK4IT = (RadioButton)grdRow.FindControl("BHK4IT");
//RadioButton VILLAIT = (RadioButton)grdRow.FindControl("VILLAIT");
CheckBox SERVENTIT = (CheckBox)grdRow.FindControl("SERVENTIT");
CheckBox PREMIUMIT = (CheckBox)grdRow.FindControl("PREMIUMIT");
CheckBox FURNISHING = (CheckBox)grdRow.FindControl("FURNISHING");
TextBox FLOORIT = (TextBox)grdRow.FindControl("FLOORIT");
TextBox AREAIT = (TextBox)grdRow.FindControl("AREAIT");
TextBox BUILDUPAREA = (TextBox)grdRow.FindControl("BUILDUPAREA");
TextBox DIMENSIONIT = (TextBox)grdRow.FindControl("DIMENSIONIT");
TextBox REMARKSIT = (TextBox)grdRow.FindControl("REMARKSIT");
if (chkTest.Checked)
{
FLATNOIT.Enabled = true;
FLATNOIT.ForeColor = System.Drawing.Color.Black;
BHK1IT.Enabled = true;
BHK1IT.ForeColor = System.Drawing.Color.Black;
BHK2IT.Enabled = true;
BHK2IT.ForeColor = System.Drawing.Color.Black;
BHK3IT.Enabled = true;
BHK3IT.ForeColor = System.Drawing.Color.Black;
BHK4IT.Enabled = true;
BHK4IT.ForeColor = System.Drawing.Color.Black;
//VILLAIT.Enabled = true;
//VILLAIT.ForeColor = System.Drawing.Color.Black;
SERVENTIT.Enabled = true;
SERVENTIT.ForeColor = System.Drawing.Color.Black;
PREMIUMIT.Enabled = true;
PREMIUMIT.ForeColor = System.Drawing.Color.Black;
FURNISHING.Enabled = true;
FURNISHING.ForeColor = System.Drawing.Color.Black;
FLOORIT.Enabled = true;
FLOORIT.ForeColor = System.Drawing.Color.Black;
AREAIT.Enabled = true;
AREAIT.ForeColor = System.Drawing.Color.Black;
BUILDUPAREA.Enabled = true;
BUILDUPAREA.ForeColor = System.Drawing.Color.Black;
DIMENSIONIT.Enabled = true;
DIMENSIONIT.ForeColor = System.Drawing.Color.Black;
REMARKSIT.Enabled = true;
REMARKSIT.ForeColor = System.Drawing.Color.Black;
}
else
{
FLATNOIT.Enabled = false;
FLATNOIT.ForeColor = System.Drawing.Color.Black;
BHK1IT.Enabled = false;
BHK1IT.ForeColor = System.Drawing.Color.Black;
BHK2IT.Enabled = false;
BHK2IT.ForeColor = System.Drawing.Color.Black;
BHK3IT.Enabled = false;
BHK3IT.ForeColor = System.Drawing.Color.Black;
BHK4IT.Enabled = false;
BHK4IT.ForeColor = System.Drawing.Color.Black;
//VILLAIT.Enabled = false;
//VILLAIT.ForeColor = System.Drawing.Color.Black;
SERVENTIT.Enabled = false;
SERVENTIT.ForeColor = System.Drawing.Color.Black;
PREMIUMIT.Enabled = false;
PREMIUMIT.ForeColor = System.Drawing.Color.Black;
FURNISHING.Enabled = false;
FURNISHING.ForeColor = System.Drawing.Color.Black;
FLOORIT.Enabled = false;
FLOORIT.ForeColor = System.Drawing.Color.Black;
AREAIT.Enabled = false;
AREAIT.ForeColor = System.Drawing.Color.Black;
BUILDUPAREA.Enabled = false;
BUILDUPAREA.ForeColor = System.Drawing.Color.Black;
DIMENSIONIT.Enabled = false;
DIMENSIONIT.ForeColor = System.Drawing.Color.Black;
REMARKSIT.Enabled = false;
REMARKSIT.ForeColor = System.Drawing.Color.Black;
}
}
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
CheckBox chkSelectAll = sender as CheckBox;
chkSelectAll.Text = chkSelectAll.Checked ? "Deselect All" : "Select All";
foreach (GridViewRow grdRow in GridView1.Rows)
{
CheckBox chkSelect = grdRow.FindControl("chkSelect") as CheckBox;
if (chkSelect != null)
{
chkSelect.Checked = chkSelectAll.Checked;
TextBox FLATNOIT = (TextBox)grdRow.FindControl("FLATNOIT");
RadioButton BHK1IT = (RadioButton)grdRow.FindControl("BHK1IT");
RadioButton BHK2IT = (RadioButton)grdRow.FindControl("BHK2IT");
RadioButton BHK3IT = (RadioButton)grdRow.FindControl("BHK3IT");
RadioButton BHK4IT = (RadioButton)grdRow.FindControl("BHK4IT");
//RadioButton VILLAIT = (RadioButton)grdRow.FindControl("VILLAIT");
CheckBox SERVENTIT = (CheckBox)grdRow.FindControl("SERVENTIT");
CheckBox PREMIUMIT = (CheckBox)grdRow.FindControl("PREMIUMIT");
CheckBox FURNISHING = (CheckBox)grdRow.FindControl("FURNISHING");
TextBox FLOORIT = (TextBox)grdRow.FindControl("FLOORIT");
TextBox AREAIT = (TextBox)grdRow.FindControl("AREAIT");
TextBox BUILDUPAREA = (TextBox)grdRow.FindControl("BUILDUPAREA");
TextBox DIMENSIONIT = (TextBox)grdRow.FindControl("DIMENSIONIT");
TextBox REMARKSIT = (TextBox)grdRow.FindControl("REMARKSIT");
if (chkSelect.Checked)
{
FLATNOIT.Enabled = true;
FLATNOIT.ForeColor = System.Drawing.Color.Black;
BHK1IT.Enabled = true;
BHK1IT.ForeColor = System.Drawing.Color.Black;
BHK2IT.Enabled = true;
BHK2IT.ForeColor = System.Drawing.Color.Black;
BHK3IT.Enabled = true;
BHK3IT.ForeColor = System.Drawing.Color.Black;
BHK4IT.Enabled = true;
BHK4IT.ForeColor = System.Drawing.Color.Black;
//VILLAIT.Enabled = true;
//VILLAIT.ForeColor = System.Drawing.Color.Black;
SERVENTIT.Enabled = true;
SERVENTIT.ForeColor = System.Drawing.Color.Black;
PREMIUMIT.Enabled = true;
PREMIUMIT.ForeColor = System.Drawing.Color.Black;
FURNISHING.Enabled = true;
FURNISHING.ForeColor = System.Drawing.Color.Black;
FLOORIT.Enabled = true;
FLOORIT.ForeColor = System.Drawing.Color.Black;
AREAIT.Enabled = true;
AREAIT.ForeColor = System.Drawing.Color.Black;
BUILDUPAREA.Enabled = true;
BUILDUPAREA.ForeColor = System.Drawing.Color.Black;
DIMENSIONIT.Enabled = true;
DIMENSIONIT.ForeColor = System.Drawing.Color.Black;
REMARKSIT.Enabled = true;
REMARKSIT.ForeColor = System.Drawing.Color.Black;
}
else
{
FLATNOIT.Enabled = false;
FLATNOIT.ForeColor = System.Drawing.Color.Black;
BHK1IT.Enabled = false;
BHK1IT.ForeColor = System.Drawing.Color.Black;
BHK2IT.Enabled = false;
BHK2IT.ForeColor = System.Drawing.Color.Black;
BHK3IT.Enabled = false;
BHK3IT.ForeColor = System.Drawing.Color.Black;
BHK4IT.Enabled = false;
BHK4IT.ForeColor = System.Drawing.Color.Black;
//VILLAIT.Enabled = false;
//VILLAIT.ForeColor = System.Drawing.Color.Black;
SERVENTIT.Enabled = false;
SERVENTIT.ForeColor = System.Drawing.Color.Black;
PREMIUMIT.Enabled = false;
PREMIUMIT.ForeColor = System.Drawing.Color.Black;
FURNISHING.Enabled = false;
FURNISHING.ForeColor = System.Drawing.Color.Black;
FLOORIT.Enabled = false;
FLOORIT.ForeColor = System.Drawing.Color.Black;
AREAIT.Enabled = false;
AREAIT.ForeColor = System.Drawing.Color.Black;
BUILDUPAREA.Enabled = false;
BUILDUPAREA.ForeColor = System.Drawing.Color.Black;
DIMENSIONIT.Enabled = false;
DIMENSIONIT.ForeColor = System.Drawing.Color.Black;
REMARKSIT.Enabled = false;
REMARKSIT.ForeColor = System.Drawing.Color.Black;
}
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
foreach (GridViewRow grdRow in GridView1.Rows)
{
int ft = 1;
CheckBox chkSelect = grdRow.FindControl("chkSelect") as CheckBox;
HiddenField id = (HiddenField)grdRow.FindControl("pid");
TextBox FLATNOIT = (TextBox)grdRow.FindControl("FLATNOIT");
RadioButton BHK1IT = (RadioButton)grdRow.FindControl("BHK1IT");
RadioButton BHK2IT = (RadioButton)grdRow.FindControl("BHK2IT");
RadioButton BHK3IT = (RadioButton)grdRow.FindControl("BHK3IT");
RadioButton BHK4IT = (RadioButton)grdRow.FindControl("BHK4IT");
//RadioButton VILLAIT = (RadioButton)grdRow.FindControl("VILLAIT");
CheckBox SERVENTIT = (CheckBox)grdRow.FindControl("SERVENTIT");
CheckBox PREMIUMIT = (CheckBox)grdRow.FindControl("PREMIUMIT");
CheckBox FURNISHING = (CheckBox)grdRow.FindControl("FURNISHING");
TextBox FLOORIT = (TextBox)grdRow.FindControl("FLOORIT");
TextBox AREAIT = (TextBox)grdRow.FindControl("AREAIT");
TextBox BUILDUPAREA = (TextBox)grdRow.FindControl("BUILDUPAREA");
TextBox DIMENSIONIT = (TextBox)grdRow.FindControl("DIMENSIONIT");
TextBox REMARKSIT = (TextBox)grdRow.FindControl("REMARKSIT");
if (BHK1IT.Checked == true)
ft = 1;
else if (BHK2IT.Checked == true)
ft = 2;
else if (BHK3IT.Checked == true)
ft = 3;
else if (BHK4IT.Checked == true)
ft = 4;
//else if (VILLAIT.Checked == true)
// ft = 5;
if (chkSelect.Checked)
{
string update = "update FLATDETAIL set FLATNO='" + FLATNOIT.Text + "', BHK1='" + BHK1IT.Checked + "',BHK2='" + BHK2IT.Checked + "',BHK3='" + BHK3IT.Checked + "',BHK4='" + BHK4IT.Checked + "',PREMIUM='" + PREMIUMIT.Checked + "',SERVENT='" + SERVENTIT.Checked + "', SIZE='" + AREAIT.Text + "',BUILDUPAREA='" + BUILDUPAREA.Text + "',DIMENSION='" + DIMENSIONIT.Text + "',REMARKS='" + REMARKSIT.Text + "',FLATTYPEID='" + ft + "',flor='" + FLOORIT.Text + "',FURNISHING='" + FURNISHING.Checked + "' where FLATID='" + id.Value + "' and book='False' ";
bool sec = obj.ExecuteQuery(update);
}
}
string updateby = "insert into UpdateBy (UserId,WorkTime,ProjectCode,TblName,RowId) values('" + Session["id"].ToString() + "','" + System.DateTime.Now.ToString() + "','" + Mpid + "','FLATDETAIL','" + Mpid + "')";
SqlHelper.ExecuteNonQuery(con, CommandType.Text, updateby);
data();
}
<asp:GridView ID="GridView1" runat="server" EmptyDataText="No Record" Style="text-align: center;
font-family: Arial, Helvetica, sans-serif; font-size: small; margin-left: 0px;"
DataKeyNames="FLATID" AutoGenerateColumns="False" Width="100%" CellPadding="4"
ForeColor="#333333" GridLines="None" AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging"
PageSize="15">
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<Columns>
<asp:TemplateField HeaderText="Select">
<HeaderTemplate>
<asp:CheckBox ID="chkSelectAll" runat="server" AutoPostBack="true" Text="Select All"
OnCheckedChanged="CheckBox1_CheckedChanged" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" AutoPostBack="true" OnCheckedChanged="chkSelect_CheckedChanged" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="" SortExpression="FLATNO">
<ItemTemplate>
<asp:HiddenField ID="pid" Value='<%# Bind("FLATID") %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Flat NO" SortExpression="FLATNO">
<EditItemTemplate>
<asp:TextBox ID="FLATNOED" runat="server" Text='<%# Bind("FLATNO") %>' Width="50px"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:TextBox ID="FLATNOIT" runat="server" Text='<%# Bind("FLATNO") %>' Enabled="false"
Width="70px" ForeColor="Black"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="BHK1" SortExpression="BHK1">
<EditItemTemplate>
<asp:RadioButton ID="BHK1ED" runat="server" Checked='<%# Bind("BHK1") %>' GroupName="a" />
</EditItemTemplate>
<ItemTemplate>
<asp:RadioButton ID="BHK1IT" runat="server" Checked='<%# Bind("BHK1") %>' Enabled="false"
GroupName="b" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="BHK2" SortExpression="BHK2">
<EditItemTemplate>
<asp:RadioButton ID="BHK2ED" runat="server" Checked='<%# Bind("BHK2") %>' GroupName="a" />
</EditItemTemplate>
<ItemTemplate>
<asp:RadioButton ID="BHK2IT" runat="server" Checked='<%# Bind("BHK2") %>' Enabled="false"
GroupName="b" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="BHK3" SortExpression="BHK3">
<EditItemTemplate>
<asp:RadioButton ID="BHK3ED" runat="server" Checked='<%# Bind("BHK3") %>' GroupName="a" />
</EditItemTemplate>
<ItemTemplate>
<asp:RadioButton ID="BHK3IT" runat="server" Checked='<%# Bind("BHK3") %>' Enabled="false"
GroupName="b" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="BHK4" SortExpression="BHK4">
<EditItemTemplate>
<asp:RadioButton ID="BHK4ED" runat="server" Checked='<%# Bind("BHK4") %>' GroupName="a" />
</EditItemTemplate>
<ItemTemplate>
<asp:RadioButton ID="BHK4IT" runat="server" Checked='<%# Bind("BHK4") %>' Enabled="false"
GroupName="b" />
</ItemTemplate>
</asp:TemplateField>
<%-- <asp:TemplateField HeaderText="BHK5" SortExpression="BHK5">
<EditItemTemplate>
<asp:RadioButton ID="VILLAED" runat="server" Checked='<%# Bind("Flat") %>' GroupName="a" />
</EditItemTemplate>
<ItemTemplate>
<asp:RadioButton ID="VILLAIT" runat="server" Checked='<%# Bind("Flat") %>' Enabled="false"
GroupName="b" />
</ItemTemplate>
</asp:TemplateField>--%>
<asp:TemplateField HeaderText="PREMIUM" SortExpression="PREMIUM">
<EditItemTemplate>
<asp:CheckBox ID="PREMIUMED" runat="server" Checked='<%# Bind("PREMIUM") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="PREMIUMIT" runat="server" Checked='<%# Bind("PREMIUM") %>' Enabled="false" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SERVENT" SortExpression="SERVENT">
<EditItemTemplate>
<asp:CheckBox ID="SERVENTED" runat="server" Checked='<%# Bind("SERVENT") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="SERVENTIT" runat="server" Checked='<%# Bind("SERVENT") %>' Enabled="false" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="FURNISHING">
<EditItemTemplate>
<asp:CheckBox ID="FURNISHING" runat="server" Checked='<%# Bind("FURNISHING") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="FURNISHING" runat="server" Checked='<%# Bind("FURNISHING") %>' Enabled="false" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="FLOOR" SortExpression="SIZE">
<EditItemTemplate>
<asp:TextBox ID="FLOORED" runat="server" Text='<%# Bind("flor") %>' Width="100px"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:TextBox ID="FLOORIT" runat="server" Text='<%# Bind("flor") %>' Enabled="false"
Width="50px" ForeColor="Black"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText=" AREA" SortExpression="SIZE">
<EditItemTemplate>
<asp:TextBox ID="AREAED" runat="server" Text='<%# Bind("SIZE") %>' Width="100px"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:TextBox ID="AREAIT" runat="server" Text='<%# Bind("SIZE") %>' Enabled="false"
Width="70px" ForeColor="Black"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="BUILT UP AREA">
<EditItemTemplate>
<asp:TextBox ID="BUILDUPAREA" runat="server" Text='<%# Bind("BUILDUPAREA") %>' Width="100px"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:TextBox ID="BUILDUPAREA" runat="server" Text='<%# Bind("BUILDUPAREA") %>' Enabled="false"
Width="100px" ForeColor="Black"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="DIMENSION" SortExpression="SIZE">
<EditItemTemplate>
<asp:TextBox ID="DIMENSIONED" runat="server" Text='<%# Bind("DIMENSION") %>' Width="100px"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:TextBox ID="DIMENSIONIT" runat="server" Text='<%# Bind("DIMENSION") %>' Enabled="false"
Width="100px" ForeColor="Black"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="REMARKS" SortExpression="SIZE">
<EditItemTemplate>
<asp:TextBox ID="REMARKSED" runat="server" Text='<%# Bind("REMARKS") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:TextBox ID="REMARKSIT" runat="server" Text='<%# Bind("REMARKS") %>' Enabled="false"
ForeColor="Black"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" Width="735PX" />
<PagerSettings Mode="NextPreviousFirstLast" FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Previous" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="All Update" OnClick="Button1_Click"
OnClientClick="var ret=confirm('Are you sure you want to Update'); if (ret==true) return true; else return false;"
Width="150px" Visible="false" />
<br />
<br />
</center>
c#
protected void updatgrid(string str)
{
GridView1.EditIndex = -1;
data();
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataBind();
data();
}
protected void chkSelect_CheckedChanged(object sender, EventArgs e)
{
CheckBox chkTest = (CheckBox)sender;
GridViewRow grdRow = (GridViewRow)chkTest.NamingContainer;
TextBox FLATNOIT = (TextBox)grdRow.FindControl("FLATNOIT");
RadioButton BHK1IT = (RadioButton)grdRow.FindControl("BHK1IT");
RadioButton BHK2IT = (RadioButton)grdRow.FindControl("BHK2IT");
RadioButton BHK3IT = (RadioButton)grdRow.FindControl("BHK3IT");
RadioButton BHK4IT = (RadioButton)grdRow.FindControl("BHK4IT");
//RadioButton VILLAIT = (RadioButton)grdRow.FindControl("VILLAIT");
CheckBox SERVENTIT = (CheckBox)grdRow.FindControl("SERVENTIT");
CheckBox PREMIUMIT = (CheckBox)grdRow.FindControl("PREMIUMIT");
CheckBox FURNISHING = (CheckBox)grdRow.FindControl("FURNISHING");
TextBox FLOORIT = (TextBox)grdRow.FindControl("FLOORIT");
TextBox AREAIT = (TextBox)grdRow.FindControl("AREAIT");
TextBox BUILDUPAREA = (TextBox)grdRow.FindControl("BUILDUPAREA");
TextBox DIMENSIONIT = (TextBox)grdRow.FindControl("DIMENSIONIT");
TextBox REMARKSIT = (TextBox)grdRow.FindControl("REMARKSIT");
if (chkTest.Checked)
{
FLATNOIT.Enabled = true;
FLATNOIT.ForeColor = System.Drawing.Color.Black;
BHK1IT.Enabled = true;
BHK1IT.ForeColor = System.Drawing.Color.Black;
BHK2IT.Enabled = true;
BHK2IT.ForeColor = System.Drawing.Color.Black;
BHK3IT.Enabled = true;
BHK3IT.ForeColor = System.Drawing.Color.Black;
BHK4IT.Enabled = true;
BHK4IT.ForeColor = System.Drawing.Color.Black;
//VILLAIT.Enabled = true;
//VILLAIT.ForeColor = System.Drawing.Color.Black;
SERVENTIT.Enabled = true;
SERVENTIT.ForeColor = System.Drawing.Color.Black;
PREMIUMIT.Enabled = true;
PREMIUMIT.ForeColor = System.Drawing.Color.Black;
FURNISHING.Enabled = true;
FURNISHING.ForeColor = System.Drawing.Color.Black;
FLOORIT.Enabled = true;
FLOORIT.ForeColor = System.Drawing.Color.Black;
AREAIT.Enabled = true;
AREAIT.ForeColor = System.Drawing.Color.Black;
BUILDUPAREA.Enabled = true;
BUILDUPAREA.ForeColor = System.Drawing.Color.Black;
DIMENSIONIT.Enabled = true;
DIMENSIONIT.ForeColor = System.Drawing.Color.Black;
REMARKSIT.Enabled = true;
REMARKSIT.ForeColor = System.Drawing.Color.Black;
}
else
{
FLATNOIT.Enabled = false;
FLATNOIT.ForeColor = System.Drawing.Color.Black;
BHK1IT.Enabled = false;
BHK1IT.ForeColor = System.Drawing.Color.Black;
BHK2IT.Enabled = false;
BHK2IT.ForeColor = System.Drawing.Color.Black;
BHK3IT.Enabled = false;
BHK3IT.ForeColor = System.Drawing.Color.Black;
BHK4IT.Enabled = false;
BHK4IT.ForeColor = System.Drawing.Color.Black;
//VILLAIT.Enabled = false;
//VILLAIT.ForeColor = System.Drawing.Color.Black;
SERVENTIT.Enabled = false;
SERVENTIT.ForeColor = System.Drawing.Color.Black;
PREMIUMIT.Enabled = false;
PREMIUMIT.ForeColor = System.Drawing.Color.Black;
FURNISHING.Enabled = false;
FURNISHING.ForeColor = System.Drawing.Color.Black;
FLOORIT.Enabled = false;
FLOORIT.ForeColor = System.Drawing.Color.Black;
AREAIT.Enabled = false;
AREAIT.ForeColor = System.Drawing.Color.Black;
BUILDUPAREA.Enabled = false;
BUILDUPAREA.ForeColor = System.Drawing.Color.Black;
DIMENSIONIT.Enabled = false;
DIMENSIONIT.ForeColor = System.Drawing.Color.Black;
REMARKSIT.Enabled = false;
REMARKSIT.ForeColor = System.Drawing.Color.Black;
}
}
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
CheckBox chkSelectAll = sender as CheckBox;
chkSelectAll.Text = chkSelectAll.Checked ? "Deselect All" : "Select All";
foreach (GridViewRow grdRow in GridView1.Rows)
{
CheckBox chkSelect = grdRow.FindControl("chkSelect") as CheckBox;
if (chkSelect != null)
{
chkSelect.Checked = chkSelectAll.Checked;
TextBox FLATNOIT = (TextBox)grdRow.FindControl("FLATNOIT");
RadioButton BHK1IT = (RadioButton)grdRow.FindControl("BHK1IT");
RadioButton BHK2IT = (RadioButton)grdRow.FindControl("BHK2IT");
RadioButton BHK3IT = (RadioButton)grdRow.FindControl("BHK3IT");
RadioButton BHK4IT = (RadioButton)grdRow.FindControl("BHK4IT");
//RadioButton VILLAIT = (RadioButton)grdRow.FindControl("VILLAIT");
CheckBox SERVENTIT = (CheckBox)grdRow.FindControl("SERVENTIT");
CheckBox PREMIUMIT = (CheckBox)grdRow.FindControl("PREMIUMIT");
CheckBox FURNISHING = (CheckBox)grdRow.FindControl("FURNISHING");
TextBox FLOORIT = (TextBox)grdRow.FindControl("FLOORIT");
TextBox AREAIT = (TextBox)grdRow.FindControl("AREAIT");
TextBox BUILDUPAREA = (TextBox)grdRow.FindControl("BUILDUPAREA");
TextBox DIMENSIONIT = (TextBox)grdRow.FindControl("DIMENSIONIT");
TextBox REMARKSIT = (TextBox)grdRow.FindControl("REMARKSIT");
if (chkSelect.Checked)
{
FLATNOIT.Enabled = true;
FLATNOIT.ForeColor = System.Drawing.Color.Black;
BHK1IT.Enabled = true;
BHK1IT.ForeColor = System.Drawing.Color.Black;
BHK2IT.Enabled = true;
BHK2IT.ForeColor = System.Drawing.Color.Black;
BHK3IT.Enabled = true;
BHK3IT.ForeColor = System.Drawing.Color.Black;
BHK4IT.Enabled = true;
BHK4IT.ForeColor = System.Drawing.Color.Black;
//VILLAIT.Enabled = true;
//VILLAIT.ForeColor = System.Drawing.Color.Black;
SERVENTIT.Enabled = true;
SERVENTIT.ForeColor = System.Drawing.Color.Black;
PREMIUMIT.Enabled = true;
PREMIUMIT.ForeColor = System.Drawing.Color.Black;
FURNISHING.Enabled = true;
FURNISHING.ForeColor = System.Drawing.Color.Black;
FLOORIT.Enabled = true;
FLOORIT.ForeColor = System.Drawing.Color.Black;
AREAIT.Enabled = true;
AREAIT.ForeColor = System.Drawing.Color.Black;
BUILDUPAREA.Enabled = true;
BUILDUPAREA.ForeColor = System.Drawing.Color.Black;
DIMENSIONIT.Enabled = true;
DIMENSIONIT.ForeColor = System.Drawing.Color.Black;
REMARKSIT.Enabled = true;
REMARKSIT.ForeColor = System.Drawing.Color.Black;
}
else
{
FLATNOIT.Enabled = false;
FLATNOIT.ForeColor = System.Drawing.Color.Black;
BHK1IT.Enabled = false;
BHK1IT.ForeColor = System.Drawing.Color.Black;
BHK2IT.Enabled = false;
BHK2IT.ForeColor = System.Drawing.Color.Black;
BHK3IT.Enabled = false;
BHK3IT.ForeColor = System.Drawing.Color.Black;
BHK4IT.Enabled = false;
BHK4IT.ForeColor = System.Drawing.Color.Black;
//VILLAIT.Enabled = false;
//VILLAIT.ForeColor = System.Drawing.Color.Black;
SERVENTIT.Enabled = false;
SERVENTIT.ForeColor = System.Drawing.Color.Black;
PREMIUMIT.Enabled = false;
PREMIUMIT.ForeColor = System.Drawing.Color.Black;
FURNISHING.Enabled = false;
FURNISHING.ForeColor = System.Drawing.Color.Black;
FLOORIT.Enabled = false;
FLOORIT.ForeColor = System.Drawing.Color.Black;
AREAIT.Enabled = false;
AREAIT.ForeColor = System.Drawing.Color.Black;
BUILDUPAREA.Enabled = false;
BUILDUPAREA.ForeColor = System.Drawing.Color.Black;
DIMENSIONIT.Enabled = false;
DIMENSIONIT.ForeColor = System.Drawing.Color.Black;
REMARKSIT.Enabled = false;
REMARKSIT.ForeColor = System.Drawing.Color.Black;
}
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
foreach (GridViewRow grdRow in GridView1.Rows)
{
int ft = 1;
CheckBox chkSelect = grdRow.FindControl("chkSelect") as CheckBox;
HiddenField id = (HiddenField)grdRow.FindControl("pid");
TextBox FLATNOIT = (TextBox)grdRow.FindControl("FLATNOIT");
RadioButton BHK1IT = (RadioButton)grdRow.FindControl("BHK1IT");
RadioButton BHK2IT = (RadioButton)grdRow.FindControl("BHK2IT");
RadioButton BHK3IT = (RadioButton)grdRow.FindControl("BHK3IT");
RadioButton BHK4IT = (RadioButton)grdRow.FindControl("BHK4IT");
//RadioButton VILLAIT = (RadioButton)grdRow.FindControl("VILLAIT");
CheckBox SERVENTIT = (CheckBox)grdRow.FindControl("SERVENTIT");
CheckBox PREMIUMIT = (CheckBox)grdRow.FindControl("PREMIUMIT");
CheckBox FURNISHING = (CheckBox)grdRow.FindControl("FURNISHING");
TextBox FLOORIT = (TextBox)grdRow.FindControl("FLOORIT");
TextBox AREAIT = (TextBox)grdRow.FindControl("AREAIT");
TextBox BUILDUPAREA = (TextBox)grdRow.FindControl("BUILDUPAREA");
TextBox DIMENSIONIT = (TextBox)grdRow.FindControl("DIMENSIONIT");
TextBox REMARKSIT = (TextBox)grdRow.FindControl("REMARKSIT");
if (BHK1IT.Checked == true)
ft = 1;
else if (BHK2IT.Checked == true)
ft = 2;
else if (BHK3IT.Checked == true)
ft = 3;
else if (BHK4IT.Checked == true)
ft = 4;
//else if (VILLAIT.Checked == true)
// ft = 5;
if (chkSelect.Checked)
{
string update = "update FLATDETAIL set FLATNO='" + FLATNOIT.Text + "', BHK1='" + BHK1IT.Checked + "',BHK2='" + BHK2IT.Checked + "',BHK3='" + BHK3IT.Checked + "',BHK4='" + BHK4IT.Checked + "',PREMIUM='" + PREMIUMIT.Checked + "',SERVENT='" + SERVENTIT.Checked + "', SIZE='" + AREAIT.Text + "',BUILDUPAREA='" + BUILDUPAREA.Text + "',DIMENSION='" + DIMENSIONIT.Text + "',REMARKS='" + REMARKSIT.Text + "',FLATTYPEID='" + ft + "',flor='" + FLOORIT.Text + "',FURNISHING='" + FURNISHING.Checked + "' where FLATID='" + id.Value + "' and book='False' ";
bool sec = obj.ExecuteQuery(update);
}
}
string updateby = "insert into UpdateBy (UserId,WorkTime,ProjectCode,TblName,RowId) values('" + Session["id"].ToString() + "','" + System.DateTime.Now.ToString() + "','" + Mpid + "','FLATDETAIL','" + Mpid + "')";
SqlHelper.ExecuteNonQuery(con, CommandType.Text, updateby);
data();
}
No comments:
Post a Comment