Click here to Skip to main content
15,916,463 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,

I would like to display the data that is relevant to the item clicked in the dropdownlist using C#.For Example,I have a dropdownlist items like General comments and Comments.The page looks like as shown below.On selecting the Comments item in the dropdownlist,The cursor need to points the Comments(Need to works like a WORD.)

General comments:

Don't ask "I need to write a booking application". Specify exactly what it is you need help with.

Comments:
Keep the question as concise as possible. If you have to include code, include the smallest snippet of code you can - do not dump your entire codebase.
Posted
Comments
priya9826 26-Dec-12 14:12pm    
Is it possible to do it in either javascript,jquery,or css?
ZurdoDev 26-Dec-12 14:20pm    
The title seems easy enough but the description is quite confusing. What exactly do you want?
[no name] 26-Dec-12 14:27pm    
i think you are talking about scrolling the page on clicking an item from the dropdown menu. Am i right??

if yes then you need to place labels on your html page using #[labelname] then redirect it to the same page by appending the label
priya9826 27-Dec-12 9:18am    
Will you Please send sample code.How to do that?

1 solution

Hi,
it can be accomplished using jquery.

C#
//get all products from DB and save them
  ProductList = new ProductsBLL().GetAllProductsList();


  this.ddl.DataValueField = "Id";
  this.ddl.DataTextField = "ProductName";

  this.ddl.DataSource = ProductList;
  this.ddl.DataBind();


and the jquery

JavaScript
$('#Main_ddl').change(function () {
            alert($('#Main_ddl').val());
        });


now, where I have used alert, you can use ajax call to go with your further code or to build a logic.

thanks
 
Share this answer
 
v2
Comments
priya9826 27-Dec-12 11:54am    
How to use ajax call()?
Faisalabadians 27-Dec-12 12:41pm    
HI PRIYA, u can use ajax call with this

$.ajax({
type: "POST",
url: "PageName.aspx/MethodName",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
// Do something interesting here.
}
});

for complete example,

http://encosia.com/using-jquery-to-directly-call-aspnet-ajax-page-methods/

about Ajax call
http://api.jquery.com/jQuery.post/
priya9826 31-Dec-12 12:52pm    
Thanks for helping.I have a static data on the page.On click of dropdownlist item,How to scroll the page to particular label?
Faisalabadians 29-Mar-13 5:23am    
first you have to determine the current location of the each lable, then you can use scrollTo() java script method. let me know if you have any query about that.

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