在标签条件下显示gridview [英] Showing gridview on condition of label
问题描述
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div align ="right">
</div>
<div align="center">
<asp:Label ID="lb1" runat="server" Text="Label"></asp:Label>
<h1><font color="olive">Create Challan</font></h1>
<table border="1" style="border-collapse: collapse; width: 369px;" cellspacing="1">
<tr>
<td width="77" height="16" align="left" ><b><font size="2" color="red">Name:</font></b></td>
<td width="77" height="16" align="left" ><b><font size="2"> <asp:Label
ID="lbl_UserName" runat="server" Font-Bold="True"></asp:Label><br /></font></b></td>
<td width="77" height="16" align="left" ><b><font size="2" color="red">StaffCode:</font></b></td>
<td width="77" height="16" align="left" ><b><font size="2"> <asp:Label
ID="lbl_address" runat="server" Font-Bold="True"></asp:Label><br /></font></b></td>
<td width="77" height="16" align="left" ><b><font size="2" color="red">Branch:</font></b></td>
<td width="77" height="16" align="left" ><b><font size="2"> <asp:Label
ID="lbl_sal" runat="server" Font-Bold="True"></asp:Label><br /></font></b></td>
<td width="77" height="16" align="left" ><b><font size="2" color="red">Designation:</font></b></td>
<td width="77" height="16" align="left" ><b><font size="2"> <asp:Label
ID="lbl_phone" runat="server" Font-Bold="True"></asp:Label><br /></font></b></td>
<td> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<script type="text/javascript">
// a startup script to get put everything in motion
window.setTimeout("ShowTime()", 1000);
</script>
</td>
</tr>
</table>
</div>
<center>
<div>
<asp:GridView ID="GridView1" runat="server"
AllowPaging="True"
DataSourceID="SqlDataSource1"
AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333">
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server"
AutoPostBack="true"
OnCheckedChanged="chkSelect_CheckedChanged" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="DocketNo" HeaderText="DocketNo"
SortExpression="ID" />
<asp:TemplateField HeaderText="BranchCode"
SortExpression="BranchCode">
<ItemTemplate>
<asp:TextBox ID="txtBranchCode" runat="server"
Text='<%# Bind("BranchCode") %>' ReadOnly="true" Width="50px"
ForeColor="Blue" BorderStyle="none"
BorderWidth="0px">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Date"
SortExpression="Date">
<ItemTemplate>
<asp:TextBox ID="txtDate" runat="server"
Text='<%# Bind("Date") %>'
ReadOnly="true" ForeColor="Blue" Width="50px"
BorderStyle="none" BorderWidth="0px">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="PKTS"
SortExpression="PKTS">
<ItemTemplate>
<asp:TextBox ID="txtPKTS" runat="server"
Text='<%# Bind("PKTS") %>' ReadOnly="true" Width="50px"
ForeColor="Blue" BorderStyle="none"
BorderWidth="0px">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="To"
SortExpression="To">
<ItemTemplate>
<asp:TextBox ID="txtTo" runat="server" Width="50px"
Text='<%# Bind("To") %>'
ReadOnly="true" ForeColor="Blue"
BorderStyle="none" BorderWidth="0px">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ActWT"
SortExpression="ActWt">
<ItemTemplate>
<asp:TextBox ID="txtActWt" runat="server"
Text='<%# Bind("ActWt") %>'
ReadOnly="true" ForeColor="Blue" Width="50px"
BorderStyle="none" BorderWidth="0px">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ChargeWt"
SortExpression="ChargeWt">
<ItemTemplate>
<asp:TextBox ID="txtChargeWt" runat="server"
Text='<%# Bind("ChargeWt") %>'
ReadOnly="true" ForeColor="Blue" Width="50px"
BorderStyle="none" BorderWidth="0px">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Mode"
SortExpression="Mode">
<ItemTemplate>
<asp:TextBox ID="Mode" runat="server"
Text='<%# Bind("Mode") %>'
ReadOnly="true" ForeColor="Blue" Width="50px"
BorderStyle="none" BorderWidth="0px">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ChallanNo"
SortExpression="ChallanNo">
<ItemTemplate>
<asp:TextBox ID="txtChallanNo" runat="server"
Text='<%# Bind("ChallanNo") %>'
ReadOnly="false" ForeColor="Blue" Width="50px"
BorderStyle="none" BorderWidth="0px">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="VehicleNo"
SortExpression="VehicleNo">
<ItemTemplate>
<asp:TextBox ID="VehicleNo" runat="server"
Text='<%# Bind("VehicleNo") %>'
ReadOnly="False" ForeColor="Blue" Width="50px"
BorderStyle="none" BorderWidth="0px">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ChallanDate"
SortExpression="ChallanDate">
<ItemTemplate>
<asp:TextBox ID="txtChallanDate" runat="server"
Text='<%# Bind("ChallanDate") %>'
ReadOnly="False" ForeColor="Blue" Width="50px"
BorderStyle="none" BorderWidth="0px">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Description"
SortExpression="Description">
<ItemTemplate>
<asp:TextBox ID="txtDescription" runat="server"
Text='<%# Bind("Description") %>'
ReadOnly="False" ForeColor="Blue" Width="50px"
BorderStyle="none" BorderWidth="0px">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EditRowStyle BackColor="#2461BF" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#EFF3FB" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F5F7FB" />
<SortedAscendingHeaderStyle BackColor="#6D95E1" />
<SortedDescendingCellStyle BackColor="#E9EBEF" />
<SortedDescendingHeaderStyle BackColor="#4870BE" />
</asp:GridView>
SELECT FROM
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:amitpandeyConnectionString %>"
SelectCommand="SELECT [Date], [DocketNo], [To], [PKTS], [ActWt], [ChargeWt], [Mode], [BranchCode],[ChallanNo] ,[ChallanDate],[VehicleNo], [Description] FROM [CreateDocket]"
DeleteCommand="DELETE FROM product WHERE (DocketNo= @DocketNo)"
UpdateCommand="UPDATE [CreateDocket] SET [To] = @To,
[Date] = @Date,[PKTS]=@PKTS,[BranchCode] = @BranchCode,[ActWt] = @ActWt,[ChargeWt]=@ChargeWt,[Mode]=@Mode,[ChallanNo]=@ChallanNo,[ChallanDate]=@ChallanDate,[VehicleNo]=@VehicleNo,[Description]=@Description WHERE [DocketNo] = @DocketNo">
<DeleteParameters>
<asp:Parameter Name="DocketNo" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Date" />
<asp:Parameter Name="PKTS" />
<asp:Parameter Name="To" />
<asp:Parameter Name="BranchCode" />
<asp:Parameter Name="ActWt" />
<asp:Parameter Name="ChargeWT" />
<asp:Parameter Name="Mode" />
<asp:Parameter Name="ChallanNo" />
<asp:Parameter Name="ChallanDate" />
<asp:Parameter Name="VehicleNo" />
<asp:Parameter Name="Description" />
</UpdateParameters>
</asp:SqlDataSource>
<br />
<asp:Button ID="btnUpdate" runat="server"
OnClick="btnUpdate_Click" Text="Save" /><br />
</div>
</center>
</form>
</body>
</html>
C# code:
C# code:
public partial class Admin_CreateChallan : System.Web.UI.Page
{
string connStr = ConfigurationManager.ConnectionStrings["amitpandeyConnectionString"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
string strConnString = ConfigurationManager.ConnectionStrings["amitpandeyConnectionString"].ConnectionString;
string str;
SqlCommand com;
lb1.Text = "<font color="Brown">" + "WELLCOME:: " + "</font>" + "<font color="red">" + Session["UserName"] + "</font>";
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = "select * from Login where UserName='" + Session["UserName"] + "'";
com = new SqlCommand(str, con);
SqlDataAdapter da = new SqlDataAdapter(com);
DataSet ds = new DataSet();
da.Fill(ds);
lbl_address.Text = ds.Tables[0].Rows[0]["UserId"].ToString();
lbl_sal.Text = ds.Tables[0].Rows[0]["Branch"].ToString();
lbl_phone.Text = ds.Tables[0].Rows[0]["Designation"].ToString();
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
StringBuilder strSql = new StringBuilder(string.Empty);
SqlConnection con = new SqlConnection(connStr);
SqlCommand cmd = new SqlCommand();
for (int i = 0; i < GridView1.Rows.Count; i++)
{
CheckBox chkUpdate = (CheckBox)
GridView1.Rows[i].Cells[0].FindControl("chkSelect");
if (chkUpdate != null)
{
if (chkUpdate.Checked)
{
string strDocketNo = GridView1.Rows[i].Cells[1].Text;
string strBranchCode = ((TextBox)GridView1.Rows[i].FindControl("txtBranchCode")).Text;
string strDate = ((TextBox)GridView1.Rows[i].FindControl("txtDate")).Text;
string strPKTS = ((TextBox)GridView1.Rows[i].FindControl("txtPKTS")).Text;
string strTo = ((TextBox)GridView1.Rows[i].FindControl("txtTo")).Text;
string strActWt = ((TextBox)GridView1.Rows[i].FindControl("txtActwt")).Text;
string strChargeWt = ((TextBox)GridView1.Rows[i].FindControl("txtChargeWt")).Text;
string strMode = ((TextBox)GridView1.Rows[i].FindControl("txtMode")).Text;
string strChallanNo = ((TextBox)GridView1.Rows[i].FindControl("txtChallanNo")).Text;
string strVehicleNo = ((TextBox)GridView1.Rows[i].FindControl("txtVehicleNo")).Text;
string strChallanDate = ((TextBox)GridView1.Rows[i].FindControl("txtChallanDate")).Text;
string strDescription = ((TextBox)GridView1.Rows[i].FindControl("txtDescription")).Text;
string strUpdate = "Update CreateDocket set BranchCode = '" + strBranchCode + "', Date = '" + strDate + "', PKTS = '" + strPKTS + "',To = '" + strTo + "',ActWt = '" + strActWt + "',ChargeWt = '" + strChargeWt + "',Mode = '" + strMode + "',ChallanNo = '" + strChallanNo + "',VehicleNo = '" + strVehicleNo + "',ChallanDate = '" + strChallanDate + "',Description = '" + strDescription + "' WHERE DocketNo ='" + strDocketNo + "'";
strSql.Append(strUpdate);
}
}
}
try
{
cmd.CommandType = CommandType.Text;
cmd.CommandText = strSql.ToString();
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
}
catch (SqlException ex)
{
string errorMsg = "Error in Updation";
errorMsg += ex.Message;
throw new Exception(errorMsg);
}
finally
{
con.Close();
}
}
protected void chkSelect_CheckedChanged
(object sender, EventArgs e)
{
CheckBox chkTest = (CheckBox)sender;
GridViewRow grdRow = (GridViewRow)chkTest.NamingContainer;
TextBox txtBranchCode = (TextBox)grdRow.FindControl("txtBranchCode");
TextBox txtDate = (TextBox)grdRow.FindControl("txtDate");
TextBox txtPKTS = (TextBox)grdRow.FindControl("txtPKTS");
TextBox txtTo = (TextBox)grdRow.FindControl("txtTo");
TextBox txtActWT = (TextBox)grdRow.FindControl("txtActWT");
TextBox txtChargeWt = (TextBox)grdRow.FindControl("txtChargeWt");
TextBox txtMode = (TextBox)grdRow.FindControl("txtMode");
TextBox txtChallanNo = (TextBox)grdRow.FindControl("txtChallanNo");
TextBox txtVehicleNo = (TextBox)grdRow.FindControl("txtVehicleNo");
TextBox txtChallanDate = (TextBox)grdRow.FindControl("txtChallanDate");
TextBox txtDescription = (TextBox)grdRow.FindControl("txtDescription");
if (chkTest.Checked)
{
txtChallanNo.ReadOnly = false;
txtVehicleNo.ReadOnly = false;
txtChallanDate.ReadOnly = false;
txtDescription.ReadOnly = false;
txtChallanNo.ForeColor = System.Drawing.Color.Red;
txtVehicleNo.ForeColor = System.Drawing.Color.Red;
txtChallanDate.ForeColor = System.Drawing.Color.Red;
txtDescription.ForeColor = System.Drawing.Color.Red;
}
else
{
txtChallanNo.ReadOnly = true;
txtVehicleNo.ReadOnly = true;
txtChallanDate.ReadOnly = true;
txtDescription.ReadOnly = true;
txtChallanNo.ForeColor = System.Drawing.Color.Green;
txtVehicleNo.ForeColor = System.Drawing.Color.Green;
txtChallanDate.ForeColor = System.Drawing.Color.Green;
txtDescription.ForeColor = System.Drawing.Color.Green;
}
}
}
The Label(lbl_sal)Shows me the branch Which I have Login what I want is that in the gridview there are data with different branchCode Iwant to show only that branchCode data which is there in the label(lbl_sal).In a simple database i am able to do that with the help of WHERE condition in C# but here I am not understanding where to put this condition
The Label(lbl_sal)Shows me the branch Which I have Login what I want is that in the gridview there are data with different branchCode Iwant to show only that branchCode data which is there in the label(lbl_sal).In a simple database i am able to do that with the help of WHERE condition in C# but here I am not understanding where to put this condition
推荐答案
ConnectionStrings:amitpandeyConnectionString %>\"
SelectCommand=\"SELECT [Date], [DocketNo], [To], [PKTS], [ActWt], [ChargeWt], [Mode], [BranchCode],[ChallanNo] ,[ChallanDate],[VehicleNo], [Description] FROM [CreateDocket]\"
DeleteCommand=\"DELETE FROM product WHERE (DocketNo= @DocketNo)\"
UpdateCommand=\"UPDATE [CreateDocket] SET [To] = @To, Name=\"ActWt\" />
[Date] = @Date,[PKTS]=@PKTS,[BranchCode] = @BranchCode,[ActWt] = @ActWt,[ChargeWt]=@ChargeWt,[Mode]=@Mode,[ChallanNo]=@ChallanNo,[ChallanDate]=@ChallanDate,[VehicleNo]=@VehicleNo,[Description]=@Description WHERE [DocketNo] = @DocketNo\">
<DeleteParameters>
<asp:Parameter Name=\"DocketNo\" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name=\"Date\" />
<asp:Parameter Name=\"PKTS\" />
<asp:Parameter Name=\"To\" />
<asp:Parameter Name=\"BranchCode\" />
<asp:Parameter
<asp:Parameter Name=\"ChargeWT\" />
<asp:Parameter Name=\"Mode\" />
<asp:Parameter Name=\"ChallanNo\" />
<asp:Parameter Name=\"ChallanDate\" />
<asp:Parameter Name=\"VehicleNo\" />
<asp:Parameter Name=\"Description\" />
</UpdateParameters>
</asp:SqlDataSource>
<br />
<asp:Button ID=\"btnUpdate\" runat=\"server\"
OnClick=\"btnUpdate_Click\" Text=\"Save\" /><br />
</div>
</center& gt;
</form>
</body>
</html>
ConnectionStrings:amitpandeyConnectionString %>" SelectCommand="SELECT [Date], [DocketNo], [To], [PKTS], [ActWt], [ChargeWt], [Mode], [BranchCode],[ChallanNo] ,[ChallanDate],[VehicleNo], [Description] FROM [CreateDocket]" DeleteCommand="DELETE FROM product WHERE (DocketNo= @DocketNo)" UpdateCommand="UPDATE [CreateDocket] SET [To] = @To, [Date] = @Date,[PKTS]=@PKTS,[BranchCode] = @BranchCode,[ActWt] = @ActWt,[ChargeWt]=@ChargeWt,[Mode]=@Mode,[ChallanNo]=@ChallanNo,[ChallanDate]=@ChallanDate,[VehicleNo]=@VehicleNo,[Description]=@Description WHERE [DocketNo] = @DocketNo"> <DeleteParameters> <asp:Parameter Name="DocketNo" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="Date" /> <asp:Parameter Name="PKTS" /> <asp:Parameter Name="To" /> <asp:Parameter Name="BranchCode" /> <asp:Parameter Name="ActWt" /> <asp:Parameter Name="ChargeWT" /> <asp:Parameter Name="Mode" /> <asp:Parameter Name="ChallanNo" /> <asp:Parameter Name="ChallanDate" /> <asp:Parameter Name="VehicleNo" /> <asp:Parameter Name="Description" /> </UpdateParameters> </asp:SqlDataSource> <br /> <asp:Button ID="btnUpdate" runat="server" OnClick="btnUpdate_Click" Text="Save" /><br /> </div> </center> </form> </body> </html>
C# code:
C# code:
public partial class Admin_CreateChallan : System.Web.UI.Page
{
string connStr = ConfigurationManager.ConnectionStrings["amitpandeyConnectionString"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
string strConnString = ConfigurationManager.ConnectionStrings["amitpandeyConnectionString"].ConnectionString;
string str;
SqlCommand com;
lb1.Text = "<font color="Brown">" + "WELLCOME:: " + "</font>" + "<font color="red">" + Session["UserName"] + "</font>";
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = "select * from Login where UserName='" + Session["UserName"] + "'";
com = new SqlCommand(str, con);
SqlDataAdapter da = new SqlDataAdapter(com);
DataSet ds = new DataSet();
da.Fill(ds);
lbl_address.Text = ds.Tables[0].Rows[0]["UserId"].ToString();
lbl_sal.Text = ds.Tables[0].Rows[0]["Branch"].ToString();
lbl_phone.Text = ds.Tables[0].Rows[0]["Designation"].ToString();
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
StringBuilder strSql = new StringBuilder(string.Empty);
SqlConnection con = new SqlConnection(connStr);
SqlCommand cmd = new SqlCommand();
for (int i = 0; i < GridView1.Rows.Count; i++)
{
CheckBox chkUpdate = (CheckBox)
GridView1.Rows[i].Cells[0].FindControl("chkSelect");
if (chkUpdate != null)
{
if (chkUpdate.Checked)
{
string strDocketNo = GridView1.Rows[i].Cells[1].Text;
string strBranchCode = ((TextBox)GridView1.Rows[i].FindControl("txtBranchCode")).Text;
string strDate = ((TextBox)GridView1.Rows[i].FindControl("txtDate")).Text;
string strPKTS = ((TextBox)GridView1.Rows[i].FindControl("txtPKTS")).Text;
string strTo = ((TextBox)GridView1.Rows[i].FindControl("txtTo")).Text;
string strActWt = ((TextBox)GridView1.Rows[i].FindControl("txtActwt")).Text;
string strChargeWt = ((TextBox)GridView1.Rows[i].FindControl("txtChargeWt")).Text;
string strMode = ((TextBox)GridView1.Rows[i].FindControl("txtMode")).Text;
string strChallanNo = ((TextBox)GridView1.Rows[i].FindControl("txtChallanNo")).Text;
string strVehicleNo = ((TextBox)GridView1.Rows[i].FindControl("txtVehicleNo")).Text;
string strChallanDate = ((TextBox)GridView1.Rows[i].FindControl("txtChallanDate")).Text;
string strDescription = ((TextBox)GridView1.Rows[i].FindControl("txtDescription")).Text;
string strUpdate = "Update CreateDocket set BranchCode = '" + strBranchCode + "', Date = '" + strDate + "', PKTS = '" + strPKTS + "',To = '" + strTo + "',ActWt = '" + strActWt + "',ChargeWt = '" + strChargeWt + "',Mode = '" + strMode + "',ChallanNo = '" + strChallanNo + "',VehicleNo = '" + strVehicleNo + "',ChallanDate = '" + strChallanDate + "',Description = '" + strDescription + "' WHERE DocketNo ='" + strDocketNo + "'";
strSql.Append(strUpdate);
}
}
}
try
{
cmd.CommandType = CommandType.Text;
cmd.CommandText = strSql.ToString();
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
}
catch (SqlException ex)
{
string errorMsg = "Error in Updation";
errorMsg += ex.Message;
throw new Exception(errorMsg);
}
finally
{
con.Close();
}
}
protected void chkSelect_CheckedChanged
(object sender, EventArgs e)
{
CheckBox chkTest = (CheckBox)sender;
GridViewRow grdRow = (GridViewRow)chkTest.NamingContainer;
TextBox txtBranchCode = (TextBox)grdRow.FindControl("txtBranchCode");
TextBox txtDate = (TextBox)grdRow.FindControl("txtDate");
TextBox txtPKTS = (TextBox)grdRow.FindControl("txtPKTS");
TextBox txtTo = (TextBox)grdRow.FindControl("txtTo");
TextBox txtActWT = (TextBox)grdRow.FindControl("txtActWT");
TextBox txtChargeWt = (TextBox)grdRow.FindControl("txtChargeWt");
TextBox txtMode = (TextBox)grdRow.FindControl("txtMode");
TextBox txtChallanNo = (TextBox)grdRow.FindControl("txtChallanNo");
TextBox txtVehicleNo = (TextBox)grdRow.FindControl("txtVehicleNo");
TextBox txtChallanDate = (TextBox)grdRow.FindControl("txtChallanDate");
TextBox txtDescription = (TextBox)grdRow.FindControl("txtDescription");
if (chkTest.Checked)
{
txtChallanNo.ReadOnly = false;
txtVehicleNo.ReadOnly = false;
txtChallanDate.ReadOnly = false;
txtDescription.ReadOnly = false;
txtChallanNo.ForeColor = System.Drawing.Color.Red;
txtVehicleNo.ForeColor = System.Drawing.Color.Red;
txtChallanDate.ForeColor = System.Drawing.Color.Red;
txtDescription.ForeColor = System.Drawing.Color.Red;
}
else
{
txtChallanNo.ReadOnly = true;
txtVehicleNo.ReadOnly = true;
txtChallanDate.ReadOnly = true;
txtDescription.ReadOnly = true;
txtChallanNo.ForeColor = System.Drawing.Color.Green;
txtVehicleNo.ForeColor = System.Drawing.Color.Green;
txtChallanDate.ForeColor = System.Drawing.Color.Green;
txtDescription.ForeColor = System.Drawing.Color.Green;
}
}
}
The Label(lbl_sal)Shows me the branch Which I have Login what I want is that in the gridview there are data with different branchCode Iwant to show only that branchCode data which is there in the label(lbl_sal).In a simple database i am able to do that with the help of WHERE condition in C# but here I am not understanding where to put this condition
The Label(lbl_sal)Shows me the branch Which I have Login what I want is that in the gridview there are data with different branchCode Iwant to show only that branchCode data which is there in the label(lbl_sal).In a simple database i am able to do that with the help of WHERE condition in C# but here I am not understanding where to put this condition
IN CODE
IN CODE
lbl_sal.Text = ds.Tables[0].Rows[0]["Branch"].ToString();
REPLACE Branch with BranchCode
like this
REPLACE Branch with BranchCode
like this
lbl_sal.Text = ds.Tables[0].Rows[0]["BranchCode"].ToString();
这篇关于在标签条件下显示gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!