Home | Articles|Namespace|Interview Questions|Tools|Jobs|Projects|Community
Asp.net Tutorials

»Dotnet Ads
»Message Boards
Message Boards
Dotnet Books

»Member Details
Register
Login
LogOut
Submit Code
Submit Jobs
Submit Projects

»Competition
Community
Winners
Prizes
Write For Us
Members

»Other Resources
Links
Dotnet Resources


Forums»C# .NET »



dropdown list in a datagrid

i have one dropdownlist inside a datagrid having values 1,2,3,4,5. according to this quantity i need to perform some calculations which will be displayed in anext cell of the datagrid. but it is not working.

protected void dlistShopCart_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if(e.Item.ItemType==ListItemType.AlternatingItem | e.Item.ItemType==ListItemType.Item)
{
int[] options = {1,2,3,4,5};
DropDownList list1 = new DropDownList();
list1 = (DropDownList)e.Item.FindControl("ddlQty");
list1.DataSource = options;
list1.DataBind();
//e.Item.Cells[4].Text=list1.SelectedItem.Text;
}

}



public void ddlQty_change(object sender,System.EventArgs e)
{
DropDownList list = (DropDownList)sender;
TableCell cell = list.Parent as TableCell;
DataGridItem item=cell.Parent as DataGridItem;
int index=item.ItemIndex;
item.Cells[2].Text=list.SelectedItem.Text;
}
posted by:anonymous on 7/7/2007 12:00:00 AM
© 2008 dotnetwatch.com -- Privacy policy

Website Design & Internet Marketing by Shivam