0
<asp:GridView ID="gridInboxMessage" runat="server"
AutoGenerateColumns="False"
DataSourceID="LinqDataSource1">
<Columns>
<asp:BoundField DataField="Title" HeaderText="title" ReadOnly="True" SortExpression="Title" />
<asp:TemplateField HeaderText="Body" SortExpression="Body">
<ItemTemplate>
<asp:Label ID="MyBody" runat="server"
Text='<%# TruncateText(Eval("Body"))%>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Sender">
<ItemTemplate>
<asp:Label ID="MySender" runat="server"
Text='<%# GetSenderNameFromID(Eval("Sender"))%>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Date" SortExpression="Date1">
<ItemTemplate>
<asp:Label ID="MyDate" runat="server"
Text='<%# DataBinder.Eval(Container.DataItem, "Date1", "{0:MMMM d yyy}")%>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<div id="FullBody"></div>
protected string TruncateText(object objBody)
{
string truncated = "";
if (objBody != null)
{
truncated = objBody.ToString().Length > 50 ?
objBody.ToString().Substring(0, 47) + "..." : objBody.ToString();
}
return truncated;
}
1.I想在
protected void gridInboxMessage_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = gridInboxMessage.SelectedRow;
//i want show full body in div `fullBody`
}
如何訪問到身體表現出充分的身體在DIV fullBody
2.I甚至想要背景顏色爲黑色的行?