473,396 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

issue with popualting a message on asp:label server control

hi all

i have a problem on populating a message on asp:label server control.I
am able to insert records into the table.but it is not populating any
message like "Records entered successfully". i wanted to implement
this .how to proceed can anybody tell me about this . i am using
asp.net/vb.net 2.0

here i am providing the code also:-

vb code:-

Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As
EventArgs)
If Page.IsPostBack = True Then

Dim dbcon As SqlConnection
dbcon = New SqlConnection("Data Source=.
\SQLEXPRESS;AttachDbFilename=|DataDirectory|\HRISD B.mdf;Integrated
Security=True;User Instance=True")
Dim dbcom As New SqlCommand()
dbcom.Connection = dbcon
dbcom.CommandType = CommandType.Text
dbcom.CommandText = "Insert into
TalentTeam(TalentTeamName) values(@TalentTeamName)"
dbcom.Parameters.Add("@TalentTeamName", SqlDbType.VarChar)

dbcom.Parameters("@TalentTeamName").Value =
txtRecruiterName.Text.ToString()

If txtRecruiterName.Text.Length = 0 Then
dbcom.Parameters("@TalentTeamName").Value =
System.DBNull.Value
Else
dbcom.Parameters("@TalentTeamName").Value =
txtRecruiterName.Text
End If

Try

dbcon.Open()
dbcom.ExecuteNonQuery()
lblMessage.Visible = "True"
txtRecruiterName.Text = ""
Dim result As Integer
result = dbcom.ExecuteNonQuery()

If result = 0 Then
lblMessage.Text = "Record not entered
successfully"
Else
lblMessage.Text = "Record entered successfully"
End If
Catch ex As Exception
Response.Write(ex.Message)
Response.End()
Finally
If dbcon.State = ConnectionState.Open Then
dbcon.Close()
End If
End Try
Response.Redirect("~/AddForms/addRecruiter.aspx")
Else
lblMessage.Text = "Please enter Recruiter Name"

End If

End Sub

..aspx code :-

<table>

<tr>
<td>
<asp:Panel ID="PanelEffectiveDate"
runat="server" >
<table>
<tr>
<td
align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;
<asp:Label
ID="lblAddRecruiter" runat="server" Text="Recruiter Name" ></
asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;
</td>
<td align="right">
<asp:TextBox
ID="txtRecruiterName" runat="server" Text="" ></asp:TextBox>

<asp:RequiredFieldValidator ID="rfvEnterRecruiterName" runat="server"
ControlToValidate="txtRecruiterName" ErrorMessage="Plase Enter
Recruiter Name"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td colspan="3" align="right">
<asp:Button ID="btnAdd"
runat="server" Text="ADD" OnClick="btnAdd_Click" />

</td>
</tr>
<tr>
<td colspan="2"
align="center">
<asp:Label ID="lblMessage"
runat="server" Font-Bold="true" ForeColor="blue" ></asp:Label>
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
</table>
please help me know to solve this issue.
Thanks in advance
Dhananjay
Dec 12 '07 #1
0 1073

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: moondaddy | last post by:
I want to use a asp Label control (or a <div runat=server> element) in a template column of a datagrid. In the code behind in the grid's ItemDataBound event I need to dynamically set the innerHTML...
2
by: John Holmes | last post by:
I would like to turn on a label control in javascript with the onfocus event of another control by setting the Visible property to true. When I try and reference this label control it says...
1
by: Venki | last post by:
I have a textbox to enter an email address followed by a telephone textbox. The email has a regularexpressionvalidator and a requiredfieldvalidator. The ReqField works fine, but if I put in an...
4
by: Jeronimo Bertran | last post by:
I am currently using databing to show on an asp:label the result of appending two database fields in the following way: <asp:label id=textAcknowledgedBy runat="server" Text='<%# DataBinder.Eval...
2
by: Peter Rilling | last post by:
Below is some code that I do not know why it does not work. Okay, as you can see it is simple HTML with two ASP:Label controls. Each label has some code that basically gets a string that will be...
1
by: nospamjac | last post by:
Hi, Is there a way to update the text of an asp:label on a webform without refreshing the entire page? What is called by button clicks and other events that refresh a webform control? See the...
4
by: pagates | last post by:
Hello All-- I have a number of <asp:Label CssClass="someclass">Text</asp:Labelcontrols on my page. I would like them to be shown as <div class="someclass">Text</div> rather than <span...
4
by: Guy Noir | last post by:
So, I have a table that I only want to appear after some event has fired. Using the asp:table control and the Visible property, this is a piece of cake. The problem is that when I try and drop a...
0
by: Dhananjay | last post by:
hi all i have a problem on populating a message on asp:label server control.I am able to insert records into the table.but it is not populating any message like "Records entered successfully"....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.