data grid.... very urgent......

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2007
Posts: 9
Reputation: gurusamy is an unknown quantity at this point 
Solved Threads: 0
gurusamy gurusamy is offline Offline
Newbie Poster

data grid.... very urgent......

 
0
  #1
May 25th, 2007
i want to get the index value from selected rows of data grid..
how do i get it? can anyone explain...
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 1,181
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Solved Threads: 67
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: data grid.... very urgent......

 
0
  #2
May 25th, 2007
int index = DataGrid1.SelectedIdex;
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 9
Reputation: gurusamy is an unknown quantity at this point 
Solved Threads: 0
gurusamy gurusamy is offline Offline
Newbie Poster

Re: data grid.... very urgent......

 
0
  #3
May 25th, 2007
i got index value -1 for all rows..
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 1,181
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Solved Threads: 67
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: data grid.... very urgent......

 
0
  #4
May 25th, 2007
In the aspx page DataGrid markup :

  1. <asp:DataGrid id="DataGrid1" OnItemCommand="DataGrid1_ItemCommand" ...etc.
in the aspx.cs
  1. protected void DataGrid1_ItemCommand(object sender, DataGridCommandEventArgs e)
  2. {
  3. int index = e.Item.ItemIndex;
  4. }
Last edited by WolfPack; May 25th, 2007 at 12:11 pm. Reason: Edited per user's request
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 1,181
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Solved Threads: 67
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: data grid.... very urgent......

 
0
  #5
May 25th, 2007
gurusamy (in PM to me)
i tried that too..
Whether i have to set any property for data grid..
bcoz i didn't get any event for data grid like ItemsIndex..
Have you wired up the event handler ?, if you're not using the designer but handcoding you have to add the handler delegates in the Web Form Designer generated code region of the aspx.cs file (If you're using Framework 1.1) See near the bottom of this snippet in the InitializeComponent method.

  1. #region Web Form Designer generated code
  2. override protected void OnInit(EventArgs e)
  3. {
  4. //
  5. // CODEGEN: This call is required by the ASP.NET Web Form Designer.
  6. //
  7. InitializeComponent();
  8. base.OnInit(e);
  9. }
  10.  
  11. /// <summary>
  12. /// Required method for Designer support - do not modify
  13. /// the contents of this method with the code editor.
  14. /// </summary>
  15. private void InitializeComponent()
  16. {
  17. this.Load += new System.EventHandler(this.Page_Load);
  18. this.DataGrid1.ItemCommand += new DataGridCommandEventHandler(DataGrid1_ItemCommand);
  19.  
  20. }
  21. #endregion
Last edited by hollystyles; May 25th, 2007 at 11:48 am.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC