GridView相关问题汇总
<asp:gridview id="gvData" runat="server" autogeneratecolumns="False">
<columns>
<asp:templatefield headertext="所属系统">
<itemtemplate>
<asp:label id="lblPID" runat="server" text='<%# MyChange(Eval("PID").ToString()) %>'></asp:label>
</itemtemplate>
</asp:templatefield>
<asp:templatefield headertext="问题">
<itemtemplate>
<asp:hyperlink id="hylTitle" runat="server" text='<%# Eval("Title") %>' navigateurl='<%# "~/UserShowDetail.aspx?qid=" + Eval("QID") %>'></asp:hyperlink>
</itemtemplate>
</asp:templatefield>
</columns>
</asp:gridview>
protected string MyChange(string strPID)
{
string strTemp = strPID.Substring(0, 1);
if (strTemp == "1")
{
return "一级建造师";
}
else
{
return "二级建造师";
}
}