Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 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, 04:23 PM
Registered User
 
Join Date: May 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Datagrid drowndown 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>
                                <Columns>
                                    <asp:BoundColumn Visible="False" DataField="ResLangID" ReadOnly="True" HeaderText="ResLangID"></asp:BoundColumn>
                                    <asp:BoundColumn DataField="SkillName" ReadOnly="True" HeaderText="Language Name"></asp:BoundColumn>
                                        <ItemTemplate>
                                            <%# DataBinder.Eval(Container.DataItem, "writing") %>
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <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:DropDownList>
                                        </EditItemTemplate>
                                    </asp:TemplateColumn>
                                    <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
                                </Columns>
                                <PagerStyle horizontalalign="Right" forecolor="Black" backcolor="#C6C3C6"></PagerStyle>
                            </asp:DataGrid>

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 26th, 2005, 05:26 AM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to RPG SEARCH
Default

Hi there,

For anything to do with the datagrid control I use http://aspnet.4guysfromrolla.com/articles/040502-1.aspx, the answer should be in there for your first problem.



David Jenkins
-------------------------------------------------------------
Do you want to make extra money around your commitments?
Credit cards, bills, loans and a mortgage - all getting you down?
Is your pension going to be enough when you retire?
There is a solution visit http://www.1stmillion.co.uk
or call 01772 489521
 
Old May 26th, 2005, 08:27 AM
Registered User
 
Join Date: May 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks David,
I will try to look there to see if there is anything to solve my problem. My page that contains over 10 different datagrid is now long and each time a person clicks on Edit it seems that the page refreshes itself and I am back to the top of the page again while the person might working on a datagrid at the bottom of the page. Do you know how to work around that?
Thanks for your help!
Perry

 
Old May 26th, 2005, 12:47 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You can try using smartnavaiagion = true on the page.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom paging in Datagrid with datagrid page count madhusrp ASP.NET 1.0 and 1.1 Professional 12 June 2nd, 2008 01:15 PM
Datagrid k.manisha ASP.NET 1.0 and 1.1 Professional 2 May 20th, 2008 07:18 PM
User COntrol Datagrid inside datagrid rodmcleay ASP.NET 1.0 and 1.1 Professional 3 April 14th, 2007 10:11 AM
Creating DataGrid In Repeater/DataGrid liduwan ASP.NET 1.0 and 1.1 Professional 9 March 6th, 2007 03:31 PM
datagrid ajaidass ADO.NET 2 March 1st, 2007 05:36 PM





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