private void grdShippingMode_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int modeId = (int)this.grdShippingMode.DataKeys[e.Row.RowIndex].Value; Literal literal = e.Row.FindControl("litExpressCompanyName") as Literal; IList <string> expressCompanysByMode = ShoppingProcessor.GetExpressCompanysByMode(modeId); string text = string.Empty; foreach (string current in expressCompanysByMode) { text = text + current + ","; } literal.Text = text.Remove(text.Length - 1); } }
void grdShippingMode_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { HiddenField field = (HiddenField)e.Row.FindControl("hdfModeId"); Repeater repeater = (Repeater)e.Row.FindControl("rptExpressCompanys"); if ((field != null) && (repeater != null)) { int result = 0; if (int.TryParse(field.Value, out result) && (result > 0)) { repeater.DataSource = ShoppingProcessor.GetExpressCompanysByMode(result); repeater.DataBind(); } } } }