473,385 Members | 1,622 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,385 software developers and data experts.

DataList Control

Hello,

I have a doubt...
I have a TextBox by name txtMessage.Text ,Button by name btnSend and
Datalist Control by name dltMessage i my aspx page.

when i enter the data in text box and click on the button it is storing
the data into the database.
The saved information has to displayed in the datalist....
Here the problem is for example when i enter data like this in the text box
" Hello Sir,
I have completed Msc Computer
Science from Gitam College..
and i am working as a SE at Nanna Computers Pvt Ltd.
and i am staying in Hyderabad."
I have entered like this data in the text box and pressed submit button.
the data stored in the database in which format i entered that manner only
it entered ...

code:

txtMessage.Text = txtMessage.Text.Replace(Environment.NewLine, "<br>")
txtMessage.Text = txtMessage.Text.Replace(" ", "&nbsp;")
msg.MessageText = txtMessage.Text.Replace("'", " ")
msg.SentOn = Now
msg.Send() this is to store the data into the database.

Now when i am retreving into the data list it is not properly displaying
in the data list.... The problem i identified the data list only accepts
HTML data
so what i did is when i press enter i am attaching <BR> tag in the data
where i press enter ..... but only with problem is space when give space i
have attach "&nbsp" when i encounter space but this is not the solution
since for one space i am storing 6 letters information in the data base

displaying in datagrid.
Dim Data As New DataTable
Dim DColumn As DataColumn
Dim DRow As DataRow
Dim s As System.Object

Dim startrec As Integer

If pageno = 1 Then
startrec = 0
Else
startrec = (pageno - 1) * PageSize
End If
Data = New DataTable("Files")

DColumn = New DataColumn("Message", GetType(String))
Data.Columns.Add(DColumn)
DColumn = New DataColumn("SentDate", GetType(String))
Data.Columns.Add(DColumn)
DColumn = New DataColumn("SenderID", GetType(String))
Data.Columns.Add(DColumn)

Dim i As Integer = 0

Dim DB As New Database
If DB.Run("Select SentDate, Message, SenderID from Messages where
ProjectID = '" & ProjID & "' order by SentDate Desc") Then
While DB.Result.Read
If i >= startrec And i <= (startrec + PageSize - 1) Then
DRow = Data.NewRow
DRow(0) = DB.Result("Message")
DRow(1) =
Convert.ToDateTime(DB.Result("SentDate")).ToString ("d/M/yyyy")
DRow(2) =
UserFunctions.GetEmpFullName(DB.Result("SenderID") )
Data.Rows.Add(DRow)
End If
i = i + 1
End While
End If
dltMessages.DataSource = Data
dltMessages.DataBind()

If i > 12 Then
btnNext.Enabled = True
Else
btnNext.Enabled = False
End If

lblNoMsg.Visible = False
btnPrev.Visible = True
btnNext.Visible = True
lblMsgRange.Text = "(" & startrec + 1 & "-" & startrec +
dltMessages.Items.Count & ")" & " of " & New
Project(ProjID).MessageCount
If dltMessages.Items.Count = 0 Then
lblNoMsg.Visible = True
btnPrev.Visible = False
btnNext.Visible = False
lblMsgRange.Visible = False
Else
lblNoMsg.Visible = False
lblMsgRange.Visible = True
If pageno = 1 Then
btnPrev.Visible = False
End If

If pageno = PageCount Then
btnNext.Visible = False
End If

End If

End Sub

In this code i have some related to navigation ignore it ....

Please help me
Regards,
Krishna Murthy.K


Sep 28 '05 #1
0 1272

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

Similar topics

1
by: Mike Malter | last post by:
I take it that the only way to add rows to a DataList control is through DataBind? If not, how do I manually add rows to a DataList control? I have searched everywhere and can't find an example...
10
by: Bharat | last post by:
Hi Folks, Suppose I have two link button on a page (say lnkBtn1 and lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically created control. And On the click event of the lnkBtn2 I...
6
by: tshad | last post by:
I need to get to a status label I have on my footer section of my datalist. There is no event happening that would go to the footer. I am just doing some processing and want to update the label...
4
by: Patrick.O.Ige | last post by:
I have a CheckBoxList in a DataList and i'm trying to get item Selected after doing a postBack. I have set my CheckBoxlist AutoPostBack="True" Any ideas what 'm doing wrong? It seems not to...
2
by: Hans Merkl | last post by:
Hi, I am trying to use a user control as EditItemTemplate in a DataList. It loads fine but I can't figure out how to bind to the data of the DataList. Here is what I have got so far: ...
1
by: shantanu_kush | last post by:
Hi there, I am using a DataList in a composite control. The DataList has an Custom ItemTemplate(ITemplate) which adds a Button to the DataList Item as shown in the code below : public class...
1
by: Jim in Arizona | last post by:
I'm don't know how I would get around this. When working with a datalist control, there a specific built in commands (OnEditCommand, OnCancelCommand, etc). These commands, when the datalist...
6
by: Victor | last post by:
Hi. all I have a customize web control. I have three simple properties and customized render class. then I add this control into my datalist like <asp:DataList ID="datalist" runat="server"...
3
by: Crazy Cat | last post by:
Hi all, I am developing an asp.net 2.0 application in Visual Studio 2005. On my page I have a simple datalist that is bound programmatically to a collection of simple objects. On this page I...
4
by: Peter | last post by:
I have a DataList and each item in the datalist has an imge, I want to change the datalist item image on the client side when user clicks a button. How would I do that with JavaScript, does anyone...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.