Beginners question

Joined
Jun 4, 2008
Messages
7
Reaction score
0
I have the following code:

public partial class _Default : System.Web.UI.Page
{

String sql2 = "";
DataSet ds;

protected void Button1_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
QueryCommand smd = new QueryCommand(sql2);<- HERE sql2 isNOT NULL
ds = DataService.GetDataSet(smd); <- HERE ds isNOT NULL
GridView1.DataSource = ds;
}

protected void GridView1_Sorting1(object sender, GridViewSortEventArgs e)
{
QueryCommand smd = new QueryCommand(sql2); <- HERE sql2 is NULL
ds = DataService.GetDataSet(smd); <- HERE ds is NULL
}
}

Question: How can I get the values of the variables from Button_Click so I can use them in GridView1_Sorting1 method?

Please help me I feel totally lost.

Thank you in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top