24/09/2008, 08:39
|
| | | Fecha de Ingreso: marzo-2008
Mensajes: 38
Antigüedad: 16 años, 8 meses Puntos: 0 | |
Respuesta: duda sobre obtener valores en la fila de un gridview Ya lo resolvi utilizando el dataKeyName, aqui va mi codigo donde tomo el valor de una fila seleccionada y se lo paso a un formulario.
protected void GVSelectUpdate_SelectedIndexChanged1(object sender, EventArgs e)
{
string informationId = GVSelectUpdate.SelectedDataKey["informationId"].ToString();
string imagesId = GVSelectUpdate.SelectedDataKey["imagesId"].ToString();
string SelectInformationUpdate = @"SELECT sectionId,informationTypeId,informationTitle,infor mationSumary,informationText,informationActive,ima gesId
FROM dbo.tbl_information WHERE (informationId = @informationId)";
DataView dvSelectInformationUpdate = BDataSql.SelectSqlDS(cxn,SelectInformationUpdate, new Parameter("informationId", TypeCode.String, informationId));
string SelectImageUpdate = @"SELECT imagesCaption,imagesFileName,images FROM tbl_images
WHERE (imagesId = @imagesId)";
DataView dvSelectImageUpdate = BDataSql.SelectSqlDS(cxn, SelectImageUpdate, new Parameter("imagesId", TypeCode.String, imagesId));
tbl_sectionTableAdapter tbl_ddlSection2= new tbl_sectionTableAdapter();
DataTable FillddlSection2 = tbl_ddlSection2.GetData();
Utility.FillDDL(ddlSection2, FillddlSection2, "sectionName", "sectionId", ddlSeccion.SelectedValue.ToString());
tbl_informationTypeTableAdapter tbl_ddlTypeInformation2 = new tbl_informationTypeTableAdapter();
DataTable FillddlTypeInformation2 = tbl_ddlTypeInformation2.GetData();
Utility.FillDDL(ddlTypeInformation2, FillddlTypeInformation2, "informationTypeDescription", "informationTypeId", ddlTypeInformation.SelectedValue.ToString());
txtTitle.Text = dvSelectInformationUpdate.Table.Rows[0]["informationTitle"].ToString();
txtSumary.Text = dvSelectInformationUpdate.Table.Rows[0]["informationSumary"].ToString();
txtInformation.Text = dvSelectInformationUpdate.Table.Rows[0]["informationText"].ToString();
chkBoxActive.Checked = bool.Parse(dvSelectInformationUpdate.Table.Rows[0]["informationActive"].ToString());
txtImageCaption.Text = dvSelectImageUpdate.Table.Rows[0]["imagesCaption"].ToString();
} |