Wrox Programmer Forums
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 25th, 2005, 03:51 PM
Registered User
Join Date: May 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Please help

Hi everyone,
I am fairly new to ASP.NET programming and am working on a small project where I have to create an intranet portal where people can update their skills. I am using data grid to populate my data using Web Matrix tool. I am running into 2 problems when I convert a default text box when users click on Edit into a combo box:
1-Combo box doesnt automatically select the prepolulated data
2-Is there a way to write a better code than what I have below as I have to do this for 10 different datagrid on the same page and each datagrid has 5 different dropdowns edits.
I would really appreciate any help and feedback in this: Here is a sample code I have:

<asp:DataGrid id="dgLanguage" runat="server" Width="393px" Font-Names="Times New Roman" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" BackColor="White" CellPadding="3" GridLines="None" AutoGenerateColumns="False" Font-Size="X-Small" OnEditCommand="dgLanguage_Edit" OnUpdateCommand="dgLanguage_Update" OnCancelCommand="dgLanguage_Cancel" CellSpacing="1">
                                <FooterStyle forecolor="Black" backcolor="#C6C3C6"></FooterStyle>
                                <SelectedItemStyle font-bold="True" forecolor="White" backcolor="#9471DE"></SelectedItemStyle>
                                <ItemStyle forecolor="Black" backcolor="#DEDFDE"></ItemStyle>
                                <HeaderStyle font-bold="True" forecolor="#E7E7FF" backcolor="#4A3C8C"></HeaderStyle>
                                    <asp:BoundColumn Visible="False" DataField="ResLangID" ReadOnly="True" HeaderText="ResLangID"></asp:BoundColumn>
                                    <asp:BoundColumn DataField="SkillName" ReadOnly="True" HeaderText="Language Name"></asp:BoundColumn>
                                            <%# DataBinder.Eval(Container.DataItem, "writing") %>
                                            <asp:DropDownList id="ddl3" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlSelectionChanged">
                                                <asp:ListItem Value="0">None</asp:ListItem>
                                                <asp:ListItem Value="1">Working Knowledge</asp:ListItem>
                                                <asp:ListItem Value="2">Good</asp:ListItem>
                                                <asp:ListItem Value="3">Fluent</asp:ListItem>
                                                <asp:ListItem Value="4">Native</asp:ListItem>
                                    <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
                                <PagerStyle horizontalalign="Right" forecolor="Black" backcolor="#C6C3C6"></PagerStyle>

Protected Sub ddlSelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim ddl As DropDownList,dd2 As DropDownList,dd3 As DropDownList,dd4 As DropDownList,dd5 As DropDownList
        ddl = CType(sender, DropDownList)
        dd2 = CType(sender, DropDownList)
        dd3 = CType(sender, DropDownList)
        dd4 = CType(sender, DropDownList)
        dd4 = CType(sender, DropDownList)
        'Label3.Text = ddl.SelectedItem.Text

End Sub

Old May 25th, 2005, 04:45 PM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

Cross-post. See: http://p2p.wrox.com/topic.asp?TOPIC_ID=30986 for any answers.....

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.