0

I am working on a project in which i have used autocomplete extender with textbox. And on textxhanged event of that textbox i am populating two dropdown which were initially empty. Now the thing is i have two panel. I am copying data from one panel to another. All the attributes of both panels are same. Now the thing is that i am having two radio button one is for copying data from panel one and other is for new data insert. Now if i choose copy option then it is copying all the values but at that those two dropdown stay empty. And i am doing it by using javascript. Please suggest me or guide me to solve this problem. Is it possible to call textchanged event of textbox using javascript??

Note: I am populating dropdowns and autocompleteextender using database.

0

3 Answers 3

1

You can use onchange event of textbox in javascript.

Sign up to request clarification or add additional context in comments.

1 Comment

i know that but i want to call the text change event which is at coding side. Is it possible?
0

you can you __doPostBack javascript function from asp.net with the name of text box for which you want to raise this event.

Comments

0

Solution:

Try this,

 <script type="text/javascript">
    window.onload = xyz;

          function xyz() {

              document.getElementById('<%= button1.ClientID %>').click();

          }
    <script>
    <asp:TextBox ID="textbox1" runat="server" ontextchanged="textbox1_TextChanged"></asp:TextBox>

<asp:Button ID="button1" runat="server" style=" display:none;" onclick="button1_Click"  />

CodeBehind:

    protected void button1_Click(object sender, EventArgs e)
    {
        textbox1_TextChanged(null, null)
    }
    protected void textbox1_TextChanged(object sender, EventArgs e)
    {
        //your code here
    }

4 Comments

its not working.... as i have used onClientClick as well ..
ScriptManager.RegisterClientScriptBlock(this.Page, GetType(), "OnClientClick", "OnClientClick(); return false;", true);
Call it from server side in button1_Click event
I hope it works for you! :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.