Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 31, 2013 10:46 AM by vinz
Member
11 Points
168 Posts
Jan 30, 2013 10:14 AM|LINK
Hi
I am fetching data of column of TEXT datatype from SQL Server 2008 and binding that to gridview.
But the problem is its not in readable format.
please help me to do this
Thanks in advance
All-Star
127011 Points
17934 Posts
MVP
Jan 30, 2013 10:25 AM|LINK
What exactly do you mean by "not readable"? does it contain special characters or the text displays very long?
Jan 31, 2013 10:20 AM|LINK
Text displays very long.
The actual data will be in the format of bullets and paragraphs, but the data in grid is not in that format it will be like continues words.
Jan 31, 2013 10:46 AM|LINK
Try the following:
Set HtmlEncode to false
Or try to decode ti manually at rowdatabound event like:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[index].Text = Server.HtmlDecode(e.Row.Cells[index].Text); } }
Lastly, you could convert your boundfield to templatefield and display the data in a literal control:
<asp:Literal runat="server" ID="Literal1" Text='<%# Eval("FieldName")>' />
sush_indus
Member
11 Points
168 Posts
bind data into grid view in readable format
Jan 30, 2013 10:14 AM|LINK
Hi
I am fetching data of column of TEXT datatype from SQL Server 2008 and binding that to gridview.
But the problem is its not in readable format.
please help me to do this
Thanks in advance
vinz
All-Star
127011 Points
17934 Posts
MVP
Re: bind data into grid view in readable format
Jan 30, 2013 10:25 AM|LINK
What exactly do you mean by "not readable"? does it contain special characters or the text displays very long?
MessageBox Controls for WebForms | Blog | Twitter | Linkedin
sush_indus
Member
11 Points
168 Posts
Re: bind data into grid view in readable format
Jan 31, 2013 10:20 AM|LINK
Text displays very long.
The actual data will be in the format of bullets and paragraphs, but the data in grid is not in that format it will be like continues words.
vinz
All-Star
127011 Points
17934 Posts
MVP
Re: bind data into grid view in readable format
Jan 31, 2013 10:46 AM|LINK
Try the following:
Set HtmlEncode to false
Or try to decode ti manually at rowdatabound event like:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[index].Text = Server.HtmlDecode(e.Row.Cells[index].Text); } }Lastly, you could convert your boundfield to templatefield and display the data in a literal control:
<asp:Literal runat="server" ID="Literal1" Text='<%# Eval("FieldName")>' />MessageBox Controls for WebForms | Blog | Twitter | Linkedin