protected void btn_users_Click(object sender, EventArgs e) { MembershipUser CurrentUser = Membership.GetUser(); Guid UserId = (Guid)CurrentUser.ProviderUserKey; Guid otherId = new Guid(ddl_users.SelectedValue); DataTable dtt = MessageBLL.GetAllMsgBw(UserId, otherId); gv_message.DataSource = dtt; //gv_message.DataKeyNames = new string[] { "Fk_FromId", "FK_ToId" }; gv_message.DataBind(); //dtt.PrimaryKey = new DataColumn[] { dtt.Columns["MessageId"], dtt.Columns["FK_FromId"] }; //ViewState["Message"] = dtt; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //MembershipUser CurrentUser = Membership.GetUser(); //Guid UserId = (Guid)CurrentUser.ProviderUserKey; DataTable dt = MessageBLL.GetAllUsers(); ddl_users.DataSource = dt; ddl_users.DataTextField = "UserName"; ddl_users.DataValueField = "UserId"; ddl_users.DataBind(); if (Request.QueryString["messaging"] != null) { Guid otherId = new Guid(Request.QueryString["messaging"]); MembershipUser CurrentUser = Membership.GetUser(); Guid UserId = (Guid)CurrentUser.ProviderUserKey; DataTable dtt = MessageBLL.GetAllMsgBw(UserId, otherId); gv_message.DataSource = dtt; gv_message.DataBind(); } } }