private void ValidateSession() { if (base.Session[TETRISWEBSERVICESESSIONINDEX] == null) { // create the proxy TetrisWebService.TetrisWebServiceSoapClient ws = new TetrisWebService.TetrisWebServiceSoapClient(); // create a container for the SessionID cookie //ws.CookieContainer = new CookieContainer(); //Add to session base.Session[TETRISWEBSERVICESESSIONINDEX] = ws; } }
protected void Page_Load(object sender, EventArgs e) { //Create the web service proxy webService = new TetrisWebServiceSoapClient(); //Create a DataTable object and populate it with the high scores DataTable returned from the web service DataTable dt = webService.GetHighScores(); //sort the data using the Score field, and arrange it in descending order - this makes the highest score appear at the top of the table dt.DefaultView.Sort = "Score desc"; //assign the dataTable as the datasource to the GridView and bind - this makes the data viewable HighScoresGridView.DataSource = dt; HighScoresGridView.DataBind(); }
protected void btnGetHighScoreWs_Click(object sender, EventArgs e) { TetrisWebService.TetrisWebServiceSoapClient ws = new TetrisWebService.TetrisWebServiceSoapClient(); DataTable dt = ws.GetHighScores(); }