hey
i have a small but annoying problem. im trying to pass one of my textbox controls as a param in a method.
Details:
my textbox is called txtpass.Text
= = = = = = = = = = = = = = = = = = = = = = = = = = =
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
/* this class handles all events done in the main.aspx page */
namespace FrmLogin
{
public partial class Events : System.Web.UI.Page
{
private SqlConn loadserver;
protected void Page_Load(Object Sender, EventArgs es)
{
loadserver = new SqlConn("localhost","root","");
loadserver.Connect();
if (IsPostBack)
{
txtid.Text = "";
}
}
protected void BtnLogin_Click(Object sender, EventArgs e)
{
/* this doesnt work. i want to pass it as a param */
loadserver.CallBack(txtpass.Text);
/* this works however.... */
txtpass.Text = loadserver.CallBack();
}
}
}
= = = = = = = = = = = = = = = = = = = = = = = = = = =
here is my other class...ill just take a small portion of it
= = = = = = = = = = = = = = = = = = = = = = = = = = =
using System;
using System.Data;
using System.Web;
using System.Net.Sockets;
using MySql.Data;
using MySql.Data.MySqlClient;
namespace FrmLogin
{
public class SqlConn
{
private MySqlConnection sqlconn;
private MySqlCommand sqlcmd;
private string connstr;
public SqlConn(string server, string userid, string password)
{
connstr = String.Format("server={0}; userid={1}; password={2}; database=USERS",
server, userid, password);
}
public void Connect()
{
string tmp = "";
if (null != sqlconn)
{
sqlconn.Close();
}
try {
sqlconn = new MySqlConnection(connstr);
sqlconn.Open();
Auth(tmp);
} catch (MySqlException sqlex) {
throw new Exception("Couldn't connect to server: " +sqlex.Message);
} catch (SocketException sex) {
sex = null;
throw new Exception("Check your connection to the database....");
}
}
/* i want to get the value t to the txtpass.Text so that the value shows in my main.aspx page trough the param. */
public string CallBack(string t)
{
t = "server ha server ha";
return t;
}
= = = = = = = = = = = = = = = = = = = = = = = = = = =
i have a small but annoying problem. im trying to pass one of my textbox controls as a param in a method.
Details:
my textbox is called txtpass.Text
= = = = = = = = = = = = = = = = = = = = = = = = = = =
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
/* this class handles all events done in the main.aspx page */
namespace FrmLogin
{
public partial class Events : System.Web.UI.Page
{
private SqlConn loadserver;
protected void Page_Load(Object Sender, EventArgs es)
{
loadserver = new SqlConn("localhost","root","");
loadserver.Connect();
if (IsPostBack)
{
txtid.Text = "";
}
}
protected void BtnLogin_Click(Object sender, EventArgs e)
{
/* this doesnt work. i want to pass it as a param */
loadserver.CallBack(txtpass.Text);
/* this works however.... */
txtpass.Text = loadserver.CallBack();
}
}
}
= = = = = = = = = = = = = = = = = = = = = = = = = = =
here is my other class...ill just take a small portion of it
= = = = = = = = = = = = = = = = = = = = = = = = = = =
using System;
using System.Data;
using System.Web;
using System.Net.Sockets;
using MySql.Data;
using MySql.Data.MySqlClient;
namespace FrmLogin
{
public class SqlConn
{
private MySqlConnection sqlconn;
private MySqlCommand sqlcmd;
private string connstr;
public SqlConn(string server, string userid, string password)
{
connstr = String.Format("server={0}; userid={1}; password={2}; database=USERS",
server, userid, password);
}
public void Connect()
{
string tmp = "";
if (null != sqlconn)
{
sqlconn.Close();
}
try {
sqlconn = new MySqlConnection(connstr);
sqlconn.Open();
Auth(tmp);
} catch (MySqlException sqlex) {
throw new Exception("Couldn't connect to server: " +sqlex.Message);
} catch (SocketException sex) {
sex = null;
throw new Exception("Check your connection to the database....");
}
}
/* i want to get the value t to the txtpass.Text so that the value shows in my main.aspx page trough the param. */
public string CallBack(string t)
{
t = "server ha server ha";
return t;
}
= = = = = = = = = = = = = = = = = = = = = = = = = = =