Click here to Skip to main content
15,914,371 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: How to keep Track of Updates..! Pin
Hain Kurt26-Jun-06 7:34
Hain Kurt26-Jun-06 7:34 
GeneralRe: How to keep Track of Updates..! Pin
wEb GuRu...26-Jun-06 7:38
wEb GuRu...26-Jun-06 7:38 
QuestionWeb Parts Personalization Pin
Chris McGlothen26-Jun-06 5:57
Chris McGlothen26-Jun-06 5:57 
QuestionQuestion on Dynamic Controls on a UserControl in ASP.NET Pin
OrbitalThread26-Jun-06 5:35
OrbitalThread26-Jun-06 5:35 
AnswerRe: Question on Dynamic Controls on a UserControl in ASP.NET Pin
Paddy Boyd26-Jun-06 6:12
Paddy Boyd26-Jun-06 6:12 
QuestionFree open source Rich Text Editor Pin
NaNg1524126-Jun-06 5:31
NaNg1524126-Jun-06 5:31 
AnswerRe: Free open source Rich Text Editor Pin
swilly126-Jun-06 7:52
swilly126-Jun-06 7:52 
QuestionAdding a new row to a datagrid issue Pin
leckey26-Jun-06 5:13
leckey26-Jun-06 5:13 
I have a nested datagrid. Because of the way the information is set up in the database, I have separate SQL queries to populate the grid:

private void BindData()<br />
		{<br />
			strPartNumberInputReference = txtPartNumberInput.Text			 <br />
			string SQLString = "SELECT p.PartNumber, p.ID as ptID, pt.description, dd.DrawingNumber, dd.DrawingRevision, dd.DwgPath FROM parts p INNER JOIN PartTypes pt on pt.ID =p.PartTypeID LEFT JOIN DraftingData dd on dd.PartID = p.ID WHERE p.PartNumber = @PartID;SELECT w.weight, wt.Description AS wtDescription, p.PartNumber from weights w INNER JOIN weighttypes wt on wt.ID = w.weighttypeid INNER JOIN Parts p on w.PartID = p.ID WHERE p.PartNumber = @PartID;SELECT c.cost, p.PartNumber, ct.Description AS ctDescription from Costs c INNER JOIN Parts p ON c.PartID = p.Id INNER JOIN CostTypes ct on ct.Id = c.CostTypeID WHERE p.PartNumber = @PartID; SELECT s.SubPartID, s.Quantity, s.Sequence, p.PartNumber FROM SubParts s INNER JOIN Parts p ON s.PartID = p.Id "; <br />
			SqlCommand cmd = new SqlCommand();<br />
			cmd.Connection = new SqlConnection(strConnectSQL);<br />
			cmd.CommandText = SQLString;<br />
			cmd.Parameters.Add ("@PartID", strPartNumberInputReference);<br />
			SqlDataAdapter adapter = new SqlDataAdapter(cmd);<br />
			adapter.Fill(ds);<br />
			<br />
			ds.Tables[0].TableName = "Rest";<br />
			ds.Tables[1].TableName = "Weights";<br />
			ds.Tables[2].TableName = "Costs";<br />
			ds.Tables[3].TableName = "Subparts";<br />
<br />
			<br />
			dgParts.DataSource = ds;<br />
			dgParts.DataBind();<br />
			txtPartNumberInput.Text = "";<br />
	<br />
		<br />
		}


Using these separate table names is how I populate the three nested datagrids.

I have a button for the user to click to add a new blank row for the main datagrid (called "Rest"). I've been messing with it for several hours and get one error or another.

Currently I have:
private void add_Click(object sender, System.EventArgs e)<br />
		{<br />
			DataTable dt2 = ds.Tables["Rest"];<br />
			DataRow row;<br />
			row = dt2.NewRow();<br />
			row.ItemArray = dt2.Rows[0].ItemArray;<br />
			row["PartNumber"]=strPartNumberInputReference = txtPartNumberInput.Text;<br />
			//An invalid data source is being use for Description. A valid data source must implement either IListSource or IEnumerable.<br />
			//row["Description"]=DBNull.Value;<br />
			//row["partTypeID"]=DBNull.Value;<br />
			row["DrawingNumber"]=DBNull.Value;<br />
			row["DrawingRevision"]=DBNull.Value;<br />
			row["DwgPath"]=DBNull.Value;
some additional code...

but I'm getting the error "There is no row at position 0."

How should I be programming this?
AnswerRe: Adding a new row to a datagrid issue Pin
Tirthadip26-Jun-06 23:58
Tirthadip26-Jun-06 23:58 
QuestionError while calling javascript from asp.net web page Pin
Sandeep Akhare26-Jun-06 5:06
Sandeep Akhare26-Jun-06 5:06 
Question[ASP.net v2] [C#] Treeview .... Pin
lio5526-Jun-06 5:00
lio5526-Jun-06 5:00 
AnswerRe: [ASP.net v2] [C#] Treeview .... Pin
Hain Kurt26-Jun-06 7:30
Hain Kurt26-Jun-06 7:30 
Questionpointing to an asp file from an iFrame in asp.net page Pin
Grapes-R-Fun26-Jun-06 4:52
Grapes-R-Fun26-Jun-06 4:52 
QuestionDatagrid Pin
klkum26-Jun-06 4:48
klkum26-Jun-06 4:48 
Questionhow to convert the date format [modified] Pin
rajeev kumar sharma26-Jun-06 4:06
rajeev kumar sharma26-Jun-06 4:06 
AnswerRe: how to convert the date format Pin
Not Active26-Jun-06 4:12
mentorNot Active26-Jun-06 4:12 
QuestionWorkstations on network Pin
JMichael246826-Jun-06 3:55
JMichael246826-Jun-06 3:55 
AnswerRe: Workstations on network Pin
swilly126-Jun-06 9:02
swilly126-Jun-06 9:02 
QuestionHaving Comma after 3 digit Pin
varun_khanna1726-Jun-06 2:39
varun_khanna1726-Jun-06 2:39 
AnswerRe: Having Comma after 3 digit Pin
Paddy Boyd26-Jun-06 3:23
Paddy Boyd26-Jun-06 3:23 
QuestionTextBox Validation in Datagrid Pin
varun_khanna1726-Jun-06 2:36
varun_khanna1726-Jun-06 2:36 
AnswerRe: TextBox Validation in Datagrid [modified] Pin
Abhijeet_priyn26-Jun-06 3:34
Abhijeet_priyn26-Jun-06 3:34 
QuestionWebServices(URGENT) Pin
Zuhair Rizvi26-Jun-06 2:22
Zuhair Rizvi26-Jun-06 2:22 
Questionhow to retrive images from database using asp.net datagrid Pin
ballameharmurali26-Jun-06 1:54
ballameharmurali26-Jun-06 1:54 
AnswerRe: how to retrive images from database using asp.net datagrid Pin
l0kke28-Jun-06 6:34
l0kke28-Jun-06 6:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.