WB Example Home page

Source: Internet
Author: User

Foreground HTML code:

<%@ page language= "C #" autoeventwireup= "true" codefile= "Main.aspx.cs" inherits= "Main"%><! DOCTYPE html>

Background C # code:

Using system;using system.collections.generic;using system.linq;using system.web;using System.Web.UI;using System.web.ui.webcontrols;public partial class main:system.web.ui.page{protected void Page_Load (object sender, Event Args e) {if (session["UID"]! = null) {if (!                IsPostBack) {Testdatacontext context = new Testdatacontext (); Specifies the data source Repeater1.datasource = context.                Info;            Repeater1.databind ();        }} else {Response.Redirect ("denglu.aspx"); }}//Gender function point with function to display male/female public string Showsex () {return Convert.toboolean (Eval ("Sex"))?    "Male": "Female";        public string shownation () {Testdatacontext context = new Testdatacontext (); The Nation code for each item is a string type that is placed in code with string code = Eval ("Nation").        ToString (); The code checks the nation table as long as his name returns directly to the return context. Nation.where (p = p.cOde = = code). First ().    Name; The public string Showbirthday () {///BIRTHDA This column returns a DateTime type return Convert.todatetime (Eval ("Birthday") ).    ToString ("yyyy mm month DD day"); } protected void Button2_Click (object sender, EventArgs e) {///combination query//The first step takes all the data in a collection containing TestD        Atacontext context = new Testdatacontext ();        list<info> list = Context.Info.ToList ();        The second step takes the first and second query conditions of string code = Txtcode.text; if (Code! = ") {//From the list collection, the code list = List of code equals input is filtered out. Where (p = = P.code = = Code).        ToList ();        } String name = txtName.Text; if (Name! = "") {list = list. Where (P = = P.name.contains (Name)).        ToList ();        }//To Reapeater do data source repeater1.datasource = list;    Repeater1.databind ();    } protected void button1_click (object sender, EventArgs e) {Response.Redirect ("insert.aspx"); }}

Page Display Picture:

WB Example Home page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.