Beginners question

Discussion in '.NET' started by tsaprout, Jun 19, 2008.

  1. tsaprout

    tsaprout

    Joined:
    Jun 4, 2008
    Messages:
    7
    Likes Received:
    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.
     
    tsaprout, Jun 19, 2008
    #1
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.