DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   ASP.NET (http://www.daniweb.com/forums/forum18.html)
-   -   asynchronous dropdownlist any idea (http://www.daniweb.com/forums/thread83713.html)

sasindagi Jul 17th, 2007 5:32 am
asynchronous dropdownlist any idea
 
any idea about asynchronous drop downlist, on selected item of drop downlist with out causing server round trip how can we populate selected item into textbox.(with out postback or callback)

aravindkishore Jul 17th, 2007 7:29 am
Re: asynchronous dropdownlist any idea
 
Hey Use AJAX Extension controls .Which are available at http://ajax.asp.net/default.aspx?tabid=47.Download and install and use it.DOcumentation also there you can download it use it.

coming to your problem I solved using AJAX controls as

<script runat="server">

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
TextBox1.Text = DropDownList1.SelectedItem.Value;
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"
Width="100px">
<asp:ListItem Selected="True">first_item</asp:ListItem>
<asp:ListItem>second_item</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>

</div>
</form>
</body>
</html>

I think this works

Infarction Jul 17th, 2007 10:17 pm
Re: asynchronous dropdownlist any idea
 
aravindkishore, please use [code] and [/code] tags when you post code. :icon_wink:

sasindagi Jul 18th, 2007 5:29 am
Re: asynchronous dropdownlist any idea
 
error creating update panel any idea

arjunsasidharan Jul 19th, 2007 3:16 am
Re: asynchronous dropdownlist any idea
 
Did you put the Update panel under the Script Manager? And did you install the AjaxToolKitExtender.vsi?

sasindagi Jul 19th, 2007 3:49 am
Re: asynchronous dropdownlist any idea
 
yes i had installed AjaxToolKitExtender.vsi other than update panel i can see all controls

sasindagi Jul 19th, 2007 3:50 am
Re: asynchronous dropdownlist any idea
 
never mind i got javascript without postback in dropdownlist

arjunsasidharan Jul 19th, 2007 4:21 am
Re: asynchronous dropdownlist any idea
 
Good for you.. :) so did it work?


All times are GMT -4. The time now is 1:41 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC