TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
selvi subramanian
NA
799
570.9k
i entered the sales return the balance is never change .
Apr 30 2014 5:11 AM
if i entered the sales return the balance is never change please refer my code in (Button1_Click) and desing.
if i click the to return i need to add balance + return its cuming but in that label it show as 9
balance is9 + return is 1=10 in label6 it show as 9 please check this error
my design
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="purchasereturn.aspx.cs" Inherits="purchasereturn" %>
<!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">
.style1
{
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="style1">
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="barcode"></asp:Label>
</td>
<td>
<%--<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>--%>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
onselectedindexchanged="DropDownList1_SelectedIndexChanged" Width="120px">
<asp:ListItem>--select--</asp:ListItem>
<asp:ListItem>1000</asp:ListItem>
<asp:ListItem>1001</asp:ListItem>
<asp:ListItem>1002</asp:ListItem>
<asp:ListItem>1003</asp:ListItem>
</asp:DropDownList> </td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="goods" Visible="false"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox2" runat="server" Visible="false"></asp:TextBox> </td>
</tr>
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="sales" Visible="false"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox3" runat="server" Visible="false"></asp:TextBox> </td>
</tr>
<tr>
<td>
<asp:Label ID="Label4" runat="server" Text="balance" Visible="true"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox4" runat="server" Visible="true"></asp:TextBox>
<asp:Label ID="Label6" runat="server" Visible="true"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label5" runat="server" Text="salesreturn"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox5" runat="server" AutoPostBack="True"
ontextchanged="TextBox5_TextChanged"></asp:TextBox> </td>
</tr>
<tr>
<td>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
</td>
<td>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
my coding
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class purchasereturn : System.Web.UI.Page
{
SqlConnection con;
SqlDataAdapter sda;
protected void Page_Load(object sender, EventArgs e)
{
con=new SqlConnection("Data Source=SELVI-PC\\SQLEXPRESS;Initial Catalog=demo;Persist Security Info=True;Integrated Security=True");
//sda = new SqlDataAdapter("select balance from purchase where barcode=" + DropDownList1.SelectedItem.Text.ToString(), con);
}
protected void Button1_Click(object sender, EventArgs e)
{
Session["balance"]= TextBox4.Text;
try
{
if (TextBox5.Text != "")
{
TextBox4.Text = (Convert.ToInt32(TextBox4.Text) + Convert.ToInt32(TextBox5.Text)).ToString();
Label6.Text = "Our Balnce stock is" + (Session["balance"].ToString());
// DataSet ds = new DataSet();
//sda = new SqlDataAdapter("select balance from purchase where barcode=" + DropDownList1.SelectedItem.Text.ToString(), con);
//sda.Fill(ds);
//// Session["balance"] = TextBox4.Text;
// TextBox4.Text = ds.Tables[0].Rows[0]["balance"].ToString();
//Label6.Text = "Our Balnceis" + ds.Tables[0].Rows[0]["balance"].ToString();
//Label6.Text = "our bal is" + TextBox4.Text.ToString();
}
else if(TextBox5.Text=="")
{
Label6.Text = "Our Balnce stock is"+ (Session["balance"].ToString());
}
}
catch
{
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (DropDownList1.SelectedIndex > 0)
{
DataSet ds = new DataSet();
try
{
con.Open();
sda = new SqlDataAdapter("select balance from purchase where barcode=" + DropDownList1.SelectedItem.Text.ToString(), con);
sda.Fill(ds);
TextBox4.Text = ds.Tables[0].Rows[0]["balance"].ToString();
}
catch
{
}
}
}
protected void TextBox5_TextChanged(object sender, EventArgs e)
{
if (TextBox5.Text!= "")
{
Label6.Text = "Our Balnce stock is" + (Session["balance"].ToString());
}
else
{
}
}
}
Reply
Answers (
1
)
upload the whole folder with the contents inside
how to use validation in import excel to database table.