Click here to Skip to main content
15,922,584 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: .net Pin
surshbabuk15-Jun-06 18:21
surshbabuk15-Jun-06 18:21 
GeneralRe: .net Pin
surshbabuk15-Jun-06 18:22
surshbabuk15-Jun-06 18:22 
AnswerRe: .net Pin
minhpc_bk15-Jun-06 23:43
minhpc_bk15-Jun-06 23:43 
QuestionEmail SMTP settings. [modified] Pin
Kenzy8615-Jun-06 16:52
Kenzy8615-Jun-06 16:52 
QuestionRandom password generation Pin
pitturamakrishna15-Jun-06 11:25
pitturamakrishna15-Jun-06 11:25 
AnswerRe: Random password generation Pin
Elina Blank15-Jun-06 12:23
sitebuilderElina Blank15-Jun-06 12:23 
AnswerRe: Random password generation Pin
Mircea Grelus15-Jun-06 12:51
Mircea Grelus15-Jun-06 12:51 
QuestionNewbie: Questions on datagrid, editing and datbinding Pin
leckey15-Jun-06 10:24
leckey15-Jun-06 10:24 
I've had several posts here and there. I am VERY green so if someone can point me in the right direction.

I have an app where the user enters a part number. A datagrid comes back with info based on what the user entered. Okay, that part I have down.

Question 1: I want the screen to come back and say 'no part exists' and display a BLANK ROW where the user can start to enter information about the new part number. How do I do this?

Question 2: I found an article here that discussed using a reusable databinding function. Based on some other feedback here it got tweeked. It requires two parameters:
private void BindGrid (SqlCommand command, System.Web.UI.WebControls.DataGrid DGrid)<br />
		{<br />
			SqlDataAdapter adapter = new SqlDataAdapter(command);<br />
			DataSet ds = new DataSet();<br />
			adapter.Fill(ds);<br />
			DGrid.DataSource = ds;<br />
			DGrid.DataBind();<br />
<br />
		}

So for example, when I click the button to retrieve the data, I call it like this:
private void btnSearch2_Click(object sender, System.EventArgs e)<br />
		{<br />
			strPartNumberInput2 = txtSearchPart2.Text;<br />
			string SQLString = "SELECT c.cost, pt.description, dd.DrawingNumber, dd.DrawingRevision, dd.DwgPath FROM costs c INNER JOIN Parts p ON c.PartID = p.Id INNER JOIN PartTypes pt on pt.ID = p.PartTypeID LEFT JOIN DraftingData dd on dd.PartID = p.ID WHERE p.PartNumber = @PartID";<br />
			SqlCommand cmd = new SqlCommand();<br />
			cmd.Connection = new SqlConnection(strConnectSQL);<br />
			cmd.CommandText = SQLString;<br />
			cmd.Parameters.Add ("@PartID", strPartNumberInput2);<br />
			BindGrid(cmd, DataGrid2);<br />
		}


Now I'm getting into the edit, update, cancel functions (again looking at documentation out there) such as:
public void DataGrid2_edit (object sender, DataGridCommandEventArgs e)
{<br />
			DataGrid2.EditItemIndex = e.Item.ItemIndex;<br />
			BindGrid();<br />
		}
In this example there are no parameters.

How would I pass the parameters? Do I have to repeat all the sql command and connection stuff each time?
QuestionTrouble accessing a non-secure custom error page from a secure page. Pin
vic0215-Jun-06 7:38
vic0215-Jun-06 7:38 
QuestionCode for retrieving multiple files Pin
priyankardatta15-Jun-06 6:35
priyankardatta15-Jun-06 6:35 
QuestionHow to get data into the dropdown list from database table(c#) Pin
pitturamakrishna15-Jun-06 5:08
pitturamakrishna15-Jun-06 5:08 
AnswerRe: How to get data into the dropdown list from database table(c#) Pin
albCode15-Jun-06 5:11
albCode15-Jun-06 5:11 
AnswerRe: How to get data into the dropdown list from database table(c#) Pin
varshavmane15-Jun-06 5:34
varshavmane15-Jun-06 5:34 
QuestionStatic instances Pin
Dario Solera15-Jun-06 4:33
Dario Solera15-Jun-06 4:33 
AnswerRe: Static instances Pin
Colin Angus Mackay15-Jun-06 5:17
Colin Angus Mackay15-Jun-06 5:17 
GeneralRe: Static instances Pin
Dario Solera15-Jun-06 5:23
Dario Solera15-Jun-06 5:23 
AnswerRe: Static instances Pin
Guffa15-Jun-06 5:22
Guffa15-Jun-06 5:22 
GeneralRe: Static instances Pin
Dario Solera15-Jun-06 5:24
Dario Solera15-Jun-06 5:24 
QuestionHow to point to localhost? Pin
leckey15-Jun-06 4:19
leckey15-Jun-06 4:19 
AnswerRe: How to point to localhost? Pin
Paddy Boyd15-Jun-06 4:21
Paddy Boyd15-Jun-06 4:21 
GeneralRe: How to point to localhost? Pin
leckey15-Jun-06 4:25
leckey15-Jun-06 4:25 
GeneralRe: How to point to localhost? Pin
Paddy Boyd15-Jun-06 4:26
Paddy Boyd15-Jun-06 4:26 
GeneralRe: How to point to localhost? [modified] Pin
leckey15-Jun-06 4:28
leckey15-Jun-06 4:28 
GeneralRe: How to point to localhost? Pin
Paddy Boyd15-Jun-06 4:31
Paddy Boyd15-Jun-06 4:31 
GeneralRe: How to point to localhost? Pin
leckey15-Jun-06 4:33
leckey15-Jun-06 4:33 

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.