Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
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, 2004, 06:46 AM
Registered User
 
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Nitya
Default Datagrid Template Column in Edit mode

Haee friends,
I have a Template Column (Drop Down List) in the datagrid and have also added data in the ItemDataBound event.
but what happens is when i try to edit it inline then the datagrid goes empty i tracked out that the ItemDataBound event does not fire in the case of edit inline.Can you please suggest me an alternative
thanks in advance
regards,
Nitya.
 
Old May 25th, 2004, 07:40 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Can you describe more about what you are doing with the template column? That might help us provide some advice.

What are you doing in ItemDataBound?
 
Old May 25th, 2004, 07:51 AM
Registered User
 
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Nitya
Default

haee
The template column consists of a combobox and i have populated it using a dataset.
Im trying to provide inline editing. when i click for editing the row the data in the combobox is not getting bound to the dataset.
 
Old May 25th, 2004, 08:15 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

That's odd, usually the datagrid will maintain the data of the objects/controls within it. How is the dropdownbox (there is no combobox in web forms) getting added to the template? Cany ou post the relavent pieces of code (markup and codebehind for just the control within the template column)?
 
Old May 25th, 2004, 09:11 AM
Registered User
 
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Nitya
Default

here is the code

<asp:TemplateColumn HeaderText="<b>Employee Type">
<ItemTemplate>
    <asp:DropDownList id="ddlEmpType" Runat="server"></asp:DropDownList>
</ItemTemplate>
</asp:TemplateColumn>


private void DGAddressDetails_ItemDataBound(object source,System.Web.UI.WebControls.DataGridItemEvent Args e)
{
    if(e.Item.ItemType ==ListItemType.Item || e.Item.ItemType==ListItemType.AlternatingItem)
    {
    DataRowView objRow =(DataRowView)e.Item.DataItem;


    ((DropDownList)e.Item.FindControl("ddlEmpType")).D ataSource = dsEmpType;
    ((DropDownList)e.Item.FindControl("ddlEmpType")).D ataTextField ="EmpType";
    ((DropDownList)e.Item.FindControl("ddlEmpType")).D ataValueField="EmpTypeID";
    ((DropDownList)e.Item.FindControl("ddlEmpType")).D ataBind();
    ((DropDownList)e.Item.FindControl("ddlEmpType")).I tems.FindByValue(objRow["EmpTypeID"].ToString()).Selected =true;


            }
        }



Nitya T
Associate Software Engineer,
Virtusa (India) Pvt Ltd
Hyderabad





Similar Threads
Thread Thread Starter Forum Replies Last Post
Edit Template Column in Datagrid dipal ASP.NET 1.0 and 1.1 Professional 1 January 31st, 2008 11:45 AM
Error when using DataGrid edit mode?? tryston02 ASP.NET 1.0 and 1.1 Basics 2 November 22nd, 2004 07:00 PM
Datagrid - edit mode Programator ASP.NET 1.0 and 1.1 Professional 1 September 5th, 2003 08:38 AM
Datagrid - edit mode Programator ASP.NET 1.x and 2.0 Application Design 1 September 5th, 2003 08:37 AM
Datagrid - edit mode Programator Classic ASP Professional 0 September 5th, 2003 03:13 AM





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