Click here to Skip to main content
15,911,132 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do you set focus to Page load from a routine.

Program segment


catch (Exception ex)
            {
                lblstatus.Text = ex.Message;
            }
            finally
            {
                SqlDataAdapter daa = new SqlDataAdapter("select * from GRADBULD ORDER BY CODE1", sqlCon);
                DataSet dsas = new DataSet();
                daa.Fill(dsas, "GRADBULD");
                GridView1.DataSourceID = "SqlDataSource1";
                GridView1.DataBind();
                sqlCon.Close();

                btn_Add.Enabled = true;

            }


            ///DELETE END
        }


What I have tried:

This is a program under development.

Checked a number of similar programs .

Solution not available
Posted
Updated 23-Sep-19 8:07am
v2
Comments
Richard MacCutchan 23-Sep-19 14:05pm    
What is the connection between the question and the code you showed?

1 solution

I think you need to go back a couple of steps and rethink your strategy: Page_Load is an event, not a control, and only input controls can have the focus. Add in that C# code all runs at the server, not the client, and the focus is exclusively client related (as it's only applicable to where their input goes) and your request makes absolutely no sense whatsoever.

So stop, sit back, have a coffee, and then think about what you are trying to actually do rather than how you think it perhaps show work ...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900