Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 5th, 2005, 12:40 PM
Registered User
Join Date: Dec 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default rebind dataset from web service after click button


i was developing a client web application which get the search file result from a web service , after getting the result, i would store it in a datagrid, then i would need to click the download button which retrieve the one value of the datagrid to be pass back to the web service, however, whenever it execute OnItemCommand="callDownloadFile" , it seems cant' retrieve the value from the datagrid, n i found tat whenever i click the download button , e.Item.DataItem will be NUL.. i know tat i need to rebind the result , however... i can't bind it properly..

anyone can help out with this? thanks..
private void Page_Load(object sender, System.EventArgs e)
if (!Page.IsPostBack)





public void callSearchFile()

DataGrid1.DataSource = service.SearchFile("text");

public void callDownloadFile(Object sender, DataGridCommandEventArgs e)
if (e.Item.DataItem != null)


Response.Write("second 3");
string path = ((Label)e.Item.FindControl("lblPath")).Text;


Response.Write("second one");
Old March 10th, 2005, 04:02 AM
Registered User
Join Date: Nov 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts

Create a Seperate BindData method and see

void Page_Load(Object sender, EventArgs e){
if(Page.IsPostBack != "true"){

void BindData(){
DataSet ds = new DataSet();
SQLDataSetCommand dsc;
dsc = new SQLDataSetCommand("SELECT * FROM myTable", "[connectionString]");
dsc.FillDataSet(ds, "myTable");
[Set the DataSource properties]

Old April 15th, 2005, 09:09 AM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

The problem here isn't so much that you need to rebind. After a postback, the datasource of the grid will be NULL. Therefore, e.Item.DataItem will also be NULL.

Instead of getting data from e.Item.DataItem you need to get the data from the Items cells that are in the datagrid. That's where the data grid maintains its state.

e.Item.Cells(n).Text (for a standard BoundColumn).


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create a DataSet in a Web Service amirdiwan C# 2005 1 February 22nd, 2007 04:52 PM
How to Click a web button using VB code AJD Access VBA 6 June 6th, 2006 07:32 AM
How to Click a button on a web page in VB code AJD Beginning VB 6 0 June 2nd, 2006 12:08 PM
Populating Dataset with Web Service jpitzer .NET Web Services 3 July 18th, 2004 02:36 PM
Run a web page in java application on button click mathsyaka Java GUI 3 July 2nd, 2003 11:40 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.