My code is
<asp:GridView ID="GridView_Inbox" runat="server" AutoGenerateColumns="False"
onrowcommand="GridView_Inbox_RowCommand" AllowPaging="true" PageSize="1" OnPageIndexChanging="GridView_Inbox_PageIndexChanging">
<PagerSettings Mode="NumericFirstLast" PageButtonCount="2" FirstPageText="First" LastPageText="Last"/>
<Columns>
<asp:BoundField DataField="MESSAGE_ID" HeaderText="Message ID" Visible="false" />
<asp:BoundField DataField="FIRST_NAME" HeaderText="First Name" />
<asp:BoundField DataField="LAST_NAME" HeaderText="Last Name" />
<asp:BoundField DataField="MESSAGE_SUBJECT" HeaderText="Subject" />
<asp:BoundField DataField="MESSAGE_CONTENT" HeaderText="Message" >
<HeaderStyle HorizontalAlign="Center" Width="400px" />
</asp:BoundField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="LinkButton_Inbox_Read" runat="server" CommandArgument='<%# Eval("MESSAGE_ID") %>'>Read</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
My .cs code is
protected void GridView_Inbox_RowCommand(object sender, GridViewCommandEventArgs e)
{
int MSG_ID = Convert.ToInt32(e.CommandArgument);
SysATGlobal.DB.ExecuteDMLCommand("UPDATE DSMailBox.HDR_MESSAGES SET READ_STATUS=1 WHERE MESSAGE_ID= " + MSG_ID + " ");
dt = SysATGlobal.DB.ExecuteSelectQuery("SELECT [INBOX].MESSAGE_CONTENT from DSMailBox.HDR_MESSAGES [INBOX] INNER JOIN DSProfile.HDR_PROFILE [SENDER] ON [SENDER].[PROFILE_ID] = [INBOX].[SENDER_ID] WHERE [INBOX].[RECEIVER_ID] = " + SysATGlobal.DB.MyProfile.ProfileID + " AND [INBOX].[MESSAGE_ID]=" + MSG_ID + "", false);
msg = dt.Rows[0].ItemArray.GetValue(0).ToString();
TextBox_Inbox.Text = msg;
}