Click here to Skip to main content
11,789,512 members (52,045 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET C#4.0 .NET4
i want when i click on particular item of dropdownlist(ddlprdct of my form)i want its product cost should come in a given textbox .i am not able to achieve through ddlprd_selectedindexchange but same i can achieve on clicking button...y so can i achieve through ddlprd_selectedindexchange ?
pls tell
Posted 7-Feb-13 2:09am
Avik Ghosh22 at 7-Feb-13 8:13am
use autopostback and ispostback properly..
vinodkumarnie at 1-Apr-13 7:20am
You got solution for your question..? If no share your code that you have tried..
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The details you have given are not enough. This is my understanding - you are filling up the TextBox on the server side. You are not able to do it on selected index change change event of the DropDownList. But the same is working when you click a button and post back the form.

I guess you are missing setting the AutoPostBack property of the DropDownList. Set it to true and it should work fine. So your drop down should like something like this:
<asp:DropDownList ID="ddlprd" runat="server" AutoPostBack="True" onselectedindexchanged="ddlprd_SelectedIndexChanged">
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

<asp:dropdownlist id="ddlprdct" runat="server" xmlns:asp="#unknown">

protected void itemSelected(object sender, EventArgs e)
//Write logic to get Selected Item price.

obj.product= txtProductPrice.text;

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

  Print Answers RSS
0 OriginalGriff 954
1 Maciej Los 765
2 KrunalRohit 666
3 CPallini 606
4 Richard MacCutchan 420

Advertise | Privacy | Mobile
Web04 | 2.8.1509028.1 | Last Updated 23 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100