本文介绍了如何用vb.net中的新行替换break标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 <   asp:TemplateField     HeaderText   = 考试程序    HeaderStyle-Width   =  315px >  
< ; ItemTemplate >
< asp:标签 ID = lblRepExamProc runat = server 文字 =' <% #Eval( PRCS_EXAM_PROCEDURE%> ' / >
< / ItemTemplate >
< / asp:TemplateField >







// gridload

 私有  Sub  LoadGrid()
Dim dtPrcs As DataTable
dtPrcs = clsPRCS.ListData()
如果 dtPrcs.Rows.Count> 0 然后
gridExamProcs.DataSource = dtPrcs
gridExamProcs.DataBind()
displayInfoNoRecords.Visible = False
否则
displayInfoNoRecords.Visible = True
gridExamProcs.Visible = False
结束 如果
' 返回dtUserDetails
结束 Sub







//划船活动



 受保护的  Sub  gridExamProcs_RowDataBound(sender  As  对象,e  As  System.Web.UI.WebControls.GridViewRowEventArgs)句柄 gridExamProcs.RowDataBound 

如果 e.Row.RowType = DataControlRowType.DataRow 然后


Dim lblRepExamProc = DirectCast (e.Row.FindControl( lblRepExamProc),Label)
lblRepExamProc。 Text = lblRepExamProc.Text.Replace( < \\\
>
< br />
结束 如果
结束 Sub
解方案

<asp:TemplateField HeaderText="Examination Procedures" HeaderStyle-Width="315px">
                                    <ItemTemplate>
                                        <asp:Label ID="lblRepExamProc" runat="server" Text='<%#Eval("PRCS_EXAM_PROCEDURE")%>' />
                                    </ItemTemplate>
                                </asp:TemplateField>




//gridload

Private Sub LoadGrid()
        Dim dtPrcs As DataTable
        dtPrcs = clsPRCS.ListData()
        If dtPrcs.Rows.Count > 0 Then
            gridExamProcs.DataSource = dtPrcs
            gridExamProcs.DataBind()
            displayInfoNoRecords.Visible = False
        Else
            displayInfoNoRecords.Visible = True
            gridExamProcs.Visible = False
        End If
        '  Return dtUserDetails
    End Sub




//rowbound event

Protected Sub gridExamProcs_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gridExamProcs.RowDataBound

       If e.Row.RowType = DataControlRowType.DataRow Then


           Dim lblRepExamProc = DirectCast(e.Row.FindControl("lblRepExamProc"), Label) 
lblRepExamProc.Text = lblRepExamProc.Text.Replace("<\n>", "<br/>")
       End If
   End Sub
解决方案


这篇关于如何用vb.net中的新行替换break标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 06:54