Click here to Skip to main content
11,715,043 members (63,143 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 Sergey Alexandrovich Kryukov 530
1 Richard MacCutchan 275
2 Maciej Los 259
3 ManasKumarM 155
4 Frankie-C 115
0 Sergey Alexandrovich Kryukov 775
1 CHill60 415
2 Richard MacCutchan 405
3 Maciej Los 389
4 OriginalGriff 320

Advertise | Privacy | Mobile
Web01 | 2.8.150901.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