POpulate DataGrid

Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Jan 2007
Posts: 6
Reputation: aj_daria is an unknown quantity at this point 
Solved Threads: 0
aj_daria aj_daria is offline Offline
Newbie Poster

POpulate DataGrid

 
0
  #1
Feb 8th, 2007
How can i add, delete, update using datagrid?currently, im using Sql Server as the database.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 79
Reputation: nikkiH is an unknown quantity at this point 
Solved Threads: 4
nikkiH's Avatar
nikkiH nikkiH is offline Offline
Junior Poster in Training

Re: POpulate DataGrid

 
0
  #2
Feb 12th, 2007
That highly depends on whether you meant Windows Forms or Web forms.
If you're using .net 2.0, use GridView, not DataGrid.
Google is your friend. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
Bored? Visit http://www.kaelisspace.com/
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 6
Reputation: aj_daria is an unknown quantity at this point 
Solved Threads: 0
aj_daria aj_daria is offline Offline
Newbie Poster

Re: POpulate DataGrid

 
0
  #3
Feb 13th, 2007
it is windows form. i know, the binding navigator can be used to add, delete, but i had to used button. so i didnt know how to add or delete without using the binding navigator. can anyone help me?
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 79
Reputation: nikkiH is an unknown quantity at this point 
Solved Threads: 4
nikkiH's Avatar
nikkiH nikkiH is offline Offline
Junior Poster in Training

Re: POpulate DataGrid

 
0
  #4
Feb 13th, 2007
This is pretty basic if I understand you.
Search shows a ton of tutorials and FAQs on the subject.
http://www.google.com/search?source=...=Google+Search
Google is your friend. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
Bored? Visit http://www.kaelisspace.com/
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 47
Reputation: kapil.goyal is an unknown quantity at this point 
Solved Threads: 0
kapil.goyal kapil.goyal is offline Offline
Light Poster

Re: POpulate DataGrid

 
0
  #5
Feb 15th, 2007
here is a sample code: modify according to ur need

this is for update task

TextBox tb1=new TextBox();
TextBox tb2=new TextBox();
TextBox tb3=new TextBox();
tb1=(TextBox)e.Item.Cells[2].Controls[0];
tb2=(TextBox)e.Item.Cells[3].Controls[0];
tb3=(TextBox)e.Item.Cells[6].Controls[0];
DropDownList ddl1=(DropDownList)e.Item.Cells[4].FindControl("dropdowndept");
string deptid=ddl1.SelectedItem.Value;
DropDownList ddl2=(DropDownList)e.Item.Cells[5].FindControl("dropdowndesgi");
string desgiid=ddl2.SelectedItem.Value;
int empid=Convert.ToInt32(DataGrid1.DataKeys[e.Item.ItemIndex]);

i think rest of the operations are easy.
if u r using indexing then u may have a problem in deleting a record when there is a single record in datagrid or in page.these 2 are diferent problems.if u hav this prob then ask me.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 6
Reputation: aj_daria is an unknown quantity at this point 
Solved Threads: 0
aj_daria aj_daria is offline Offline
Newbie Poster

Re: POpulate DataGrid

 
0
  #6
Feb 15th, 2007
thanks for ur reply, but for the update task, i already know the code. right now, i m having problem for adding data because it involves master detail relationship and i have to add the data from text box and also datagrid.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 47
Reputation: kapil.goyal is an unknown quantity at this point 
Solved Threads: 0
kapil.goyal kapil.goyal is offline Offline
Light Poster

Re: POpulate DataGrid

 
0
  #7
Feb 16th, 2007
just access the datagrid control value by findcontrol method by passing the id of the control in that.i think this is a sql problem rather than a grid problem.can u tell me in detail abt ur problem.
Reply With Quote Quick reply to this message  
Reply

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



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC