C sharp - No se ve mi Data Grid!!

 
Vista:

No se ve mi Data Grid!!

Publicado por Lupita (78 intervenciones) el 26/07/2006 19:07:53
Hola!!

He realizado un web service ke me obtenga datos de la tabla de northwind de sql, he conseguido ke los datos se muestren en un textbox, pero no he conseguido ke pase lo mismo con un datagrid, no me manda ningún error al realizar el evento, pero el data grid, no se ve en la pantalla, alguien podria decirme ke debo hacer.

De antemano muchas gracias...

Dejo el coodigo para ke me digan en donde esta mi error!!

private void Button1_Click(object sender, System.EventArgs e)
{
// Create a proxy object that is ready to invoke the XML Web service method.
localhost.conex svc = new localhost.conex ();

// Invoke the XML Web service method to get Products data in XML format.
string strXml = svc.GetProductsData();

// Display XML data in the text box to show what it looks like.
esc.Text = strXml;

// Read the XML data into the local DataSet.
System.IO.StringReader sr = new System.IO.StringReader(strXml);
productsDataSet2.ReadXml(sr);
productsDataSet2.AcceptChanges();

// Bind the DataGrid to the DataSet to display the data.
datagrid1.DataSource = productsDataSet2.Tables[0].DefaultView;
datagrid1.Visible =true;
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:No se ve mi Data Grid!!

Publicado por Luis Manuel (38 intervenciones) el 27/07/2006 15:42:19
Querida lupida:

Como te envien en el correo, recuerda que luego de que asignas el source donde el datagrid buscara la data y la agregara, le tienes que especificar que dichas tablas seran visualidas o el grid sera mostrado con la data.(.DATABIND())

INTENTA AGREGANDOLE EL EVENTO DATABIND(), LUEGO DEL DATASOURCE

COMO PUEDES VER EN EL EJEMPLO ABAJO

*************************************************************************
EJEMPLO
// *Bind the DataGrid to the DataSet to display the data.*//
datagrid1.DataSource = productsDataSet2.Tables[0].DefaultView;
--datagrid1.DataBind ();
datagrid1.Visible =true;
******************************************************************************

ESPERO QUE TE SEA DE AYUDA,

ESPECIALES SALUDOS;
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar