?
Solved

how to remove &gt in the grid

Posted on 2007-07-26
12
Medium Priority
?
466 Views
Last Modified: 2012-05-05
hi
i am printing some value stored in db to the gridview. on and off i get this in the text
 --->
how can i remove this &gt?
0
Comment
Question by:samir25
  • 6
  • 5
12 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 19580516
Does your string that fills the cell holds a ">" sign ?
0
 
LVL 12

Expert Comment

by:renjurdevan
ID: 19580543
Server.HtmlEncode() and Server.HtmlDecode() function used to convert Html tags

Regards
Renju
0
 
LVL 1

Author Comment

by:samir25
ID: 19580551
yes i checked it had..
0
Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

 
LVL 1

Author Comment

by:samir25
ID: 19580553
whats the diff bet the two
0
 
LVL 12

Expert Comment

by:renjurdevan
ID: 19580565



Server.HtmlEncode() used to encode html tag ie > will become &gt

and second one

Server.HtmlDecode()  used to decode html tag &gt will become >

Regards
Renju
0
 
LVL 1

Author Comment

by:samir25
ID: 19580577
ok ... can i use this server.encode in the aspx page ... in the gridview. i guess i need to put<%????
can tell me exactlu
0
 
LVL 1

Author Comment

by:samir25
ID: 19580579
like i have this
<asp:BoundField DataField="xml_data" headertext="Except./.....
0
 
LVL 12

Expert Comment

by:renjurdevan
ID: 19580602
I hope you should have used itemtemplate instead of BoundField

If it been so you can hadle these things in RowDataBound event of GridView

ie
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {// Get  XMl_data here
// I suppose you have value in szValue
//
//     e.Row.Cells[0].Text = Server.HtmlDecode(szValue); where Cell depends on your grid column
    }

Regards
Renju
0
 
LVL 1

Author Comment

by:samir25
ID: 19580619
i have all the values in boundfield. so you mean i should convert it into template column?
0
 
LVL 12

Expert Comment

by:renjurdevan
ID: 19580661
IF you want to perform any operation before databinding you should make that particular column alone as template column not all

Regards
Renju

0
 
LVL 1

Author Comment

by:samir25
ID: 19580706
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            e.Row.Cells(4).Text = Server.HtmlDecode(xml_Data)
        ElseIf e.Row.RowType = DataControlRowType.Header Then
            e.Row.Cells(4).Text = "Exception Text"
        End If
    End Sub

xml_data is the field i am usin gin boundfield...i m using              da.Fill(dt)
so how do i refer the the row ...
0
 
LVL 12

Accepted Solution

by:
renjurdevan earned 2000 total points
ID: 19580793

 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
        DataRowView obj =  ((System.Data.DataRowView)e.Row.DataItem);

        string str =   obj.Row["xml_Data"].ToString();
        }
     
e.Row.Cells[0].Text = Server.HtmlDecode(str );
    }

Please refer

http://msdn2.microsoft.com/en-US/library/aa479353.aspx

Regards
Renju
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month13 days, 14 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question