DataGrid

  • Thread starter Thread starter André Almeida Maldonado
  • Start date Start date
A

André Almeida Maldonado

Hey Guys...

What is the diference in bind data into a datagrid without predefined
columns and a datagrid with predifined columns????

When I try to bind data into a datagrid without predefined columns, I have
sucess. Otherwise, I don't have sucess.

Why????
 
what does "don't have success" mean? Is there an error?
Most likely you are binding incorectly is all.
The reason to specify the columns is numerous.... but let's look at your
issue(s) first.
 
I'm not receiving an error, the datagrid creates a new row, but the values
doesn't appear in this new row...

What can I do???
 
Is this similar to how you specified your output?
<asp:BoundColumn DataField="yourFieldName" HeaderText="Some
Text"></asp:BoundColumn>

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
 
The datasource of the datagrid is a datatable, that haves 5 columns (Id,
Description, Price, Amount, Total). The datagrid have 7 columns (Id,
Description, Price, Amount, Total, EDIT, DELETE). This last 2 columns are
columns to edit and delete rows of the datagrid.

Do you know what is happenning?????

Thank's
 
You didn't answer the question...
HOW (code please) are you tieing the datacolumn to the datagrid?

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
 
Sorry.... I really didn't answer the question.. See the code:



Dim tabPrPe As DataTable = New DataTable("Produtos")

Dim rowLinha As DataRow



Page_Load

tabPrPe.Columns.Add("Código", System.Type.GetType("System.Int16"))

tabPrPe.Columns.Add("Produto", System.Type.GetType("System.String"))

tabPrPe.Columns.Add("Unitário", System.Type.GetType("System.Double"))

tabPrPe.Columns.Add("Quantidade", System.Type.GetType("System.Double"))

tabPrPe.Columns.Add("Total", System.Type.GetType("System.Double"))


End Sub



Sub Insert......
rowLinha = tabPrPe.NewRow()

rowLinha("Código") = drpPediProd.SelectedValue

rowLinha("Produto") = drpPediProd.SelectedItem.Value

Try

rowLinha("Unitário") = Double.Parse(txtPediPrVa.Text)

Catch ex As Exception

End Try

Try

rowLinha("Quantidade") = Double.Parse(txtPediPrQu.Text)

Catch ex As Exception

End Try

rowLinha("Total") = Double.Parse(txtPediPrQu.Text)

tabPrPe.Rows.Add(rowLinha)

End Sub




This is the code....
 
step through it with the debugger. Your try/catch is probably bombing but
you have nothing in the catch.

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
 
Curt, Thank's..

I change the code and have new dificulties.... I'll post a new message...

If you could, help me again.

Thank's
 
Back
Top