Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
this is my ajax code


XML
<asp:ScriptManager ID="ScriptManager1" runat="server" />


    <asp:UpdatePanel ID="UpdatePanel25" runat="server" UpdateMode="Conditional">


<ContentTemplate >
  <asp:TextBox ID="TextBox23" runat="server"
            style="z-index: 1; left: 747px; top: 180px; position: absolute"
            ontextchanged="TextBox23_TextChanged" AutoPostBack="True"></asp:TextBox>
        </ContentTemplate>
        <Triggers>
        <asp:AsyncPostBackTrigger ControlID="TextBox23" EventName="TextChanged" />
        </Triggers>



    </asp:UpdatePanel>



in my code file i kept the break point on line 1 , it should work if the text changed pls help me out.

C#
protected void TextBox23_TextChanged(object sender, EventArgs e)   // loginID
    {
        v_liginid = TextBox23.Text; // line 1
        
    con.Open();
    SqlCommand cmd = new SqlCommand("select * from member where liginid = @v_liginid", con); 
    SqlParameter param = new SqlParameter();
    param.ParameterName = "@v_liginid"; 
    param.Value = TextBox23.Text; 
    cmd.Parameters.Add(param); 
    SqlDataReader reader = cmd.ExecuteReader(); 
        if (reader.HasRows) 
    {
        Label55.Visible=true;
    } 
    }
Posted
Updated 22-Sep-12 2:31am
v2

I'm not sure I understand your question, is the event not firing? Or is the result not correct/what you expected?

If it's the second one that might be because you check liginid with = instead of LIKE. If the user has not finished typing in his/her username (asuming that's what liginid is) then = will return false, since 'username' does not equal 'u', however it 'username' is LIKE '%u%'.

If this doesn't help, please give more details on the problem and I will try to help some more.
 
Share this answer
 
Comments
ashok_89 22-Sep-12 8:48am    
Dear Sir,

Actually the event is not firing, i checked by giving autopostback=false, and also by setting it autopostback=true
Christiaan Rakowski 22-Sep-12 9:01am    
Assuming you are using Chrome or Firefox in your development, what does the console say? Is it doing the postback, does it give a javascript error, or is it completely empty?

If it is doing the postback, to what page/handler is it going? Is this also the correct page (the one where the TextBox23_TextChanged code is?

If it does postback to the correct page, try renaming the method and see if it gives a compile error. If it does not you have duplicate names (which can happen when you call your items TextBox23)
Even is now firing, because of after, when the text change client has to leave the textbox.
add another textbox type TextBox23.Text and select the textbox which is you added
 
Share this answer
 
Comments
ashok_89 22-Sep-12 9:03am    
sir could u specify it clearly i cannt understand
Cagri Kaynar 22-Sep-12 9:18am    
add another textbox and run your project
first type your textbox23 and than type other textbox

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