protected void Button1_Click(object sender, EventArgs e) { if (TextBox1.Text.ToString() == "") { return; } if (DropDownList1.SelectedValue.ToString().Trim() == "搜贴") { string topictitle = TextBox1.Text.ToString(); topicmanage._Title = topictitle; DataSet ds = topicmanage.FindTopicByTitle(topicmanage, "aspnet_Topic"); if (ds.Tables[0].Rows.Count > 0) { SqlDataSource1.SelectCommand = string.Format("SELECT * FROM [vm_aspnet_UserTopic] WHERE (ClassID = {0} and Title like '%{1}%')", Convert.ToInt32(Session["ClsId"]), topictitle); } else { Response.Write("<script>alert('没有关于此帖消息')</script>"); } } else if (DropDownList1.SelectedValue.ToString().Trim() == "搜人") { string userName = TextBox1.Text.ToString(); usermanage._UserName = userName; DataSet ds = usermanage.FindUserByName(usermanage, "aspnet_Users"); if (ds.Tables[0].Rows.Count > 0) { Response.Redirect("SearchUser.aspx?UserName="******"<script>alert('没有关于此人消息')</script>"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Label1.Text = Request.Params["ClassValue"]; string classvalue = Request.Params["ClassValue"].ToString(); topicmanage._Title = Request.Params["TopicTitle"]; DataSet ds = topicmanage.FindTopicByTitle(topicmanage, "aspnet_Topic"); DataView dv = new DataView(ds.Tables[0]); if (Convert.ToInt32(classvalue) != 0) { int i = Convert.ToInt32(classvalue); dv.RowFilter = string.Format("ClassID = {0}", i); } GridView1.DataSource = dv; GridView1.DataBind(); } }
protected void Button1_Click(object sender, EventArgs e) { if (TextBox1.Text.ToString() == "") { return; } if (DropDownList1.SelectedValue.ToString().Trim() == "搜贴") { string topictitle = TextBox1.Text.ToString(); topicmanage._Title = topictitle; DataSet ds = topicmanage.FindTopicByTitle(topicmanage, "aspnet_Topic"); if (ds.Tables[0].Rows.Count > 0) { string classvalue = DropDownList2.SelectedValue.ToString().Trim(); Response.Redirect("SearchCard.aspx?TopicTitle=" + topictitle + "&ClassValue=" + classvalue); } else { Response.Write("<script>alert('没有关于此帖消息')</script>"); } } else if (DropDownList1.SelectedValue.ToString().Trim() == "搜人") { string userName = TextBox1.Text.ToString(); usermanage._UserName = userName; DataSet ds = usermanage.FindUserByName(usermanage, "aspnet_Users"); if (ds.Tables[0].Rows.Count > 0) { string classvalue = DropDownList2.SelectedValue.ToString().Trim(); Response.Redirect("SearchUser.aspx?UserName="******"&ClassValue=" + classvalue); } else { Response.Write("<script>alert('没有关于此人消息')</script>"); } } }