Vote. aspx. CS

Source: Internet
Author: User

using system;
using system. data;
using system. configuration;
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; // import the namespace by yourself.
Public partial class _ default: system. web. UI. page
{

private string voteid = "1";
protected void page_load (Object sender, eventargs e)
{< br> sqlconnection con = dB. createconnection ();
con. open ();
sqlcommand cmd = new sqlcommand ("select votetitle from votemaster where voteid =" + this. voteid, con); // This. voteid = 1 variable on this page
String title = convert. tostring (CMD. executescalar (); // returns the first column of the First row.
This. lbltitle. TEXT = title;

sqlcommand detail item = new sqlcommand ("select votedetailsid, voteitem from votedetails where voteid =" + this. voteid, con);
sqldatareader SDR = custom item. executereader (); // return the query result
This. rbtnitems. datatextfield = "voteitem";
This. rbtnitems. datavaluefield = "votedetailsid";
This. rbtnitems. datasource = SDR;
This. rbtnitems. databind ();

SDR. Close ();
// Con. Close ();
}

Protected void rbtnitems_selectedindexchanged (Object sender, eventargs E)
{

}
Protected void btnvote_click (Object sender, eventargs E)
{
// Sqlconnection con = d
}
}

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.