Ok I got this to work but now cant get the edit column events to fire No events fire for the datagrid at all not a sort event I tried to all not any edit button events at all. I just forgot to call DataBind() function after editing the data source. OK now it works great and I moved on the attempting to add sorting and editing to the grid and I can't get the events to fire off at all. Nothing will fire not a OnSortCommand event or and OnEditCommand Event will fire nothing! I'm using Visual Studio.Net 2003 and I noticed when I added the event through the property browser that it didn't add it to the control on the aspx page so I added it manually in the HTML code here's the code:
asp:datagrid id="dgridCustomers" style="Z-INDEX: 106; LEFT: 72px; POSITION: absolute; TOP: 240px" runat="server" Width="85%" Font-Names="Arial" Font-Size="X-Small" BackColor="AliceBlue" BorderColor="Gray" HorizontalAlign="Center" AutoGenerateColumns="False" OnEditCommand="EditRow"
It did how ever add to to the InitializeComponent fucntion in the .cs so I figuered I was good to go but the event will not fire off! nothing happens. I placed a break point in the event and it never gets reached. Here is the event code:
public
void EditRow(object sender, DataGridCommandEventArgs e) {
this.dgridCustomers.EditItemIndex = e.Item.ItemIndex; int readType = Convert.ToInt16(rdoReadTypes.SelectedValue.ToString()); switch( readType ) {
case 1: UseDataReader();
break; case 2: UseDataAdapter();
break; case 3: UseDataBinding();
break; }
}
and just for those who are curious here in my On_Load event
private
void Page_Load(object sender, System.EventArgs e) {
// Put user code to initialize the page here menu = LoadControl("mainmenu.ascx");
// run through the controls on the page and place this at the top of the form Page.FindControl("Form1").Controls.AddAt(0, menu );
((mainmenu)menu).DataGridButton.BackColor = System.Drawing.Color.White;
if( !this.IsPostBack ) UseDataReader();
}
Does anyone have any ideas what's going astray here?????? Again for the second time I'm stumped Arrrrrrg!