asp.net中的列表控件 [英] list control in asp.net

查看:86
本文介绍了asp.net中的列表控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在asp.net列表控件上.我从数据库(书籍信息)将数据获取到列表框中,并且列表框的自动回传为true.我在列表框中显示了书名.

现在我的问题是,我是否可以在文本框中为列表框中选择的每个书名显示书籍信息,如书作者,id,出版商等.

谢谢和问候,
lepakshi reddy.G

Hi,

I am working on asp.net list control. I am getting the data into the listbox from the database(book information) and the autopostback for listbox is true. I displayed the book name in the listbox.

Now my question is, can I display the book information like book author, id , publisher etc in textboxes for each bookname selected in listbox.

Thanks and regards,
lepakshi reddy.G

推荐答案

您可以做任何您想做的事情.处理列表框的selectedIndexChange事件,然后手动设置文本框或使用数据绑定.
You can do anything you would like. Handle the selectedIndexChange event for the listbox and either manually set the textboxes or use databinding.


是的,您可以做到.

Yes, You can do it.

protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
        string bookName=ListBox1.SelectedItem.Text;
        ShowBookDetails(bookName);
    }

    private void ShowBookDetails(string bookName)
    {
       //Show Book Details based on Book Name
    }



希望对您有帮助.



Hope this will help you.


这篇关于asp.net中的列表控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆