Logo 
Search:

Asp.net Answers

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds
  Question Asked By: Cameron Evans   on Jan 11 In Asp.net Category.

  
Question Answered By: Arnelle Schmidt   on Jan 11

I' m building a mail functionality where a registered user can post a message
to another registered user.I m storing all the values in a database  and when the
user enters into his inbox, the mails which are in his name will be displayed. i
ve done this using datagrid. Now i need to add a checkbox to each and every
message that is displayed and that checkbox shoul ve the messageid value also.

inbox.aspx


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="inbox.aspx.cs"
Inherits="inbox" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="DataList1" runat="server">
</asp:GridView>
</div>
</form>
</body>
</html>

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class inbox : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string user;
user = Session["User"].ToString();
SqlConnection con = new
SqlConnection("server=localhost;database=Northwind;uid=sa;pwd=server;");
string query = "select messageid,messagefrom,mailsubject,receivedtime from
mailsreceived where mailto='" + user + "'";
SqlCommand cmd = new SqlCommand(query, con);
SqlDataAdapter adap = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
adap.Fill(ds, "Mails");
DataList1.DataSource = ds.Tables["Mails"];
DataList1.DataBind();
}
}

Share: 

 

This Question has 12 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on personal web server (W95) Or get search suggestion and latest updates.


Tagged: