I found some help on the net.. here is my code .. i can't seem to find the
label lblUserNotFound.. i can get the Textbox value now.
any idea?
public void UserExist(object sender, System.EventArgs e)
{
RepeaterItem Item =
(RepeaterItem)(((System.Web.UI.Control)sender).Nam ingContainer);
int nID = Item.ItemIndex;
TextBox txtIssueTo =
(TextBox)rptIssueLaptop.Items[nID].FindControl("txtIssueTo");
Label lblUserNotFound =
(Label)rptIssueLaptop.Items[nID].FindControl("lblUserNotFound");
bool UserExist = ad.UserExist(txtIssueTo.Text);
if(UserExist==false)
{
lblUserNotFound.Text = "User not found";
}
}
"Michael Groeger" wrote:
Try to find out what object does not exist. Is it your TextBox or the object
referred as "ad"?
"huzz" <hu**@discussions.microsoft.com> schrieb im Newsbeitrag
news:A9**********************************@microsof t.com... I have a TextBox field as shown below
<asp:TextBox id="txtIssueTo" runat="server" OnTextChanged="UserExist"
AutoPostBack="true" Text="UserName"></asp:TextBox>
The UserExist method takes the txtIssueTo value and checks if the user
exist in the database.... in the UserExist method i keep getting this error
message:
Object reference not set to an instance of an object.
string strUserName = txtIssueTo.Text;
Here is my method
public void UserExist(object sender, System.EventArgs e)
{
string strUserName = txtIssueTo.Text;
bool UserExist = ad.UserExist(strUserName);
if(UserExist==false)
{
lblUserNotFound.Text = "User not found";
}
}
Any suggestions? many thanks in advance.