Click here to Skip to main content
15,879,326 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionASP.NET GridView Row Footer Pin
LSkhosana22-May-12 1:06
LSkhosana22-May-12 1:06 
AnswerRe: ASP.NET GridView Row Footer Pin
vvashishta25-May-12 2:44
vvashishta25-May-12 2:44 
QuestionMachine.config Pin
Member 387988121-May-12 6:50
Member 387988121-May-12 6:50 
AnswerRe: Machine.config Pin
Not Active21-May-12 6:57
mentorNot Active21-May-12 6:57 
GeneralMessage Removed Pin
21-May-12 7:26
Member 387988121-May-12 7:26 
GeneralRe: Machine.config Pin
Not Active21-May-12 7:42
mentorNot Active21-May-12 7:42 
QuestionAuto postback on a text control triggered by clicking on listview Pin
cahigg21-May-12 3:19
cahigg21-May-12 3:19 
Questionsetting focus to a button Pin
mathew6800720-May-12 21:33
mathew6800720-May-12 21:33 
SQL
I have 2 textboxes and a button. for texbox 1 i have used a handler for autocompletion from database. and using javascript on key pressing "enter" key the focus changes to textbox 2.. in textbox2 textchanged event i am checking a value in database corresponding to the values in textbox1.

so on post back the focus is set to textbox1. i want to be on button1.


JavaScript
$(document).ready(function() {
       $("#<%=textbox1.ClientID%>").autocomplete('../wholesalers/Handler.ashx');
   });


   $(function() {
       $('input:text:first').focus();
       var $inp = $('input:text');
       $inp.bind('keydown', function(e) {
           //var key = (e.keyCode ? e.keyCode : e.charCode);
           var key = e.which;
           if (key == 13) {
               e.preventDefault();
               var nxtIdx = $inp.index(this) + 1;
               $(":input:text:eq(" + nxtIdx + ")").focus();
           }
       });
   });



C#
protected void Page_Load(object sender, EventArgs e)
    {
        lbl_Wname.Text = Request.QueryString["name"];
        if (!IsPostBack)
        {
            textbox1.Attributes.Add("onkeypress", "returnSetfocus(event,'" + textbox1.ClientID + "')");
        }
        else
        {
            button1.Focus();
        }
    }

protected void textbox2_TextChanged(object sender, EventArgs e)
   {
       if (textbox2.Text == "" || textbox2 == null)
{
           ScriptManager.RegisterStartupScript(this, GetType(), "error", "alert('Enter Quantity');", true);
       }
       else
       {


           MySqlConnection mcn = new MySqlConnection("server=localhost;---------------------");
           mcn.Open();
           MySqlCommand cmd = new MySqlCommand();
           cmd.CommandText = "searchp";
           cmd.CommandType = CommandType.StoredProcedure;
           cmd.Connection = mcn;
           cmd.Parameters.Add("p_product_name", MySqlDbType.VarChar).Value =textbox1.Text;
           DataTable dt = new DataTable();
           MySqlDataAdapter ada = new MySqlDataAdapter(cmd);
           ada.Fill(dt);
           if (dt.Rows.Count > 0)
           {
               string sts = dt.Rows[0]["status"].ToString();
               if (sts == "available")
               {
                   Image1.ImageUrl = "~/images/tick.gif";
               }
               if (sts == "not-available")
               {
                   Image1.ImageUrl = "~/images/cross.gif";
               }
           }
           button1.Focus();
       }
    }

AnswerRe: setting focus to a button Pin
Abhinav S20-May-12 21:47
Abhinav S20-May-12 21:47 
GeneralRe: setting focus to a button Pin
Jack Li22-May-12 19:26
Jack Li22-May-12 19:26 
Questionmonitor 2010 web form Pin
sc steinhayse20-May-12 14:45
sc steinhayse20-May-12 14:45 
QuestionManually import Microsoft.Web.Administration.dll Pin
jkirkerx20-May-12 6:23
professionaljkirkerx20-May-12 6:23 
Questionxsl generate comma from nodes Pin
VinothRao19-May-12 5:05
VinothRao19-May-12 5:05 
AnswerRe: xsl generate comma from nodes Pin
mohan21_kumarv20-May-12 4:48
mohan21_kumarv20-May-12 4:48 
GeneralRe: xsl generate comma from nodes Pin
VinothRao20-May-12 17:26
VinothRao20-May-12 17:26 
Questionasp.net Pin
sajid ali laghari18-May-12 20:27
sajid ali laghari18-May-12 20:27 
AnswerRe: asp.net Pin
Pankaj Nikam19-May-12 0:37
professionalPankaj Nikam19-May-12 0:37 
QuestionPlacing points on a image Pin
Wsmithjr18-May-12 6:58
Wsmithjr18-May-12 6:58 
AnswerRe: Placing points on a image Pin
Not Active18-May-12 7:24
mentorNot Active18-May-12 7:24 
QuestionMV3 FileContentResult is not working on my server Pin
samMaster18-May-12 3:15
samMaster18-May-12 3:15 
AnswerRe: MV3 FileContentResult is not working on my server Pin
Jack Li22-May-12 19:40
Jack Li22-May-12 19:40 
QuestionHow to call a asp.net Serverside function from javascript function Pin
Rocky2318-May-12 0:25
Rocky2318-May-12 0:25 
AnswerRe: How to call a asp.net Serverside function from javascript function Pin
Parwej Ahamad19-May-12 3:22
professionalParwej Ahamad19-May-12 3:22 
QuestionDetails View Example Pin
Member 869650217-May-12 23:42
Member 869650217-May-12 23:42 
QuestionRetrieving a data element from a SQL view Pin
Member 899360917-May-12 19:58
Member 899360917-May-12 19:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.