I am getting this error "Must Declare the scalar variable "Post_ID" if i try to update 2 different ID's in my table. In other words, i can update as many times as i need to for example ID # 25 but if i try to update ID # 26 then i get the error above. My insert function works fine only my update function. Pls. help and i appreciate your time. Note, the DateKeyNames = ID. Here is my code for the update only:
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "UPDATE MyTable SET Post_ID=#Post_ID, Date=#Date, Description=#Description WHERE ID=#ID";
TextBox myTextBox11 = GV_InlineEditing.Rows[0].FindControl("GV_Post_ID") as TextBox;
TextBox myTextBox22 = GV_InlineEditing.Rows[0].FindControl("TextBox2") as TextBox;
TextBox myTextBox33 = GV_InlineEditing.Rows[0].FindControl("TextBox3") as TextBox;
if (myTextBox11 != null)
{
cmd.Parameters.Add("#Post_ID", SqlDbType.VarChar).Value = myTextBox11.Text;
}
else
{
TextBox GV_Post_ID = GV_InlineEditing.Rows[0].Cells[0].FindControl("GV_Post_ID") as TextBox;
}
if (myTextBox22 != null)
{
cmd.Parameters.Add("#Date", SqlDbType.VarChar).Value = myTextBox22.Text;
}
else
{
TextBox GV_Post_ID = GV_InlineEditing.Rows[0].Cells[0].FindControl("Date") as TextBox;
}
if (myTextBox33 != null)
{
cmd.Parameters.Add("#Description", SqlDbType.VarChar).Value = myTextBox33.Text;
}
else
{
TextBox GV_Post_ID = GV_InlineEditing.Rows[0].Cells[0].FindControl("Description") as TextBox;
}
cmd.Parameters.Add("#ID", SqlDbType.Int).Value = Convert.ToInt32(GV_InlineEditing.Rows[e.RowIndex].Cells[1].Text);
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
GV_InlineEditing.EditIndex = -1;
BindData();
Your logic is somewhat faulty:
if (myTextBox11 != null)
{
//add paramter
cmd.Parameters.Add("#Post_ID", SqlDbType.VarChar).Value = myTextBox11.Text;
}
else
{
//declare a different textbox and do not add the SQL parameter
TextBox GV_Post_ID = GV_InlineEditing.Rows[0].Cells[0].FindControl("GV_Post_ID") as TextBox;
}
This pattern is repeated for myTextBox22 and myTextBox33.
I would suggest this logic instead:
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings("MyConnectionString").ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "UPDATE MyTable SET Post_ID=#Post_ID, Date=#Date, Description=#Description WHERE ID=#ID";
TextBox myTextBox11 = GV_InlineEditing.Rows(0).FindControl("GV_Post_ID") as TextBox;
TextBox myTextBox22 = GV_InlineEditing.Rows(0).FindControl("Date") as TextBox;
TextBox myTextBox33 = GV_InlineEditing.Rows(0).FindControl("Description") as TextBox;
if (myTextBox11 == null) {
//try an alternate control for myTextBox11
myTextBox11 = GV_InlineEditing.Rows(0).Cells(0).FindControl("GV_Post_ID") as TextBox;
}
if (myTextBox22 == null) {
//try an alternate control for myTextBox22
myTextBox22 = GV_InlineEditing.Rows(0).Cells(0).FindControl("Date") as TextBox;
}
if (myTextBox33 == null) {
//try an alternate control for myTextBox33
myTextBox33 = GV_InlineEditing.Rows(0).Cells(0).FindControl("Description") as TextBox;
}
if (myTextBox11 != null & myTextBox22 != null & myTextBox33 != null) {
//all three textbox controls found
cmd.Parameters.Add("#Post_ID", SqlDbType.VarChar).Value = myTextBox11.Text;
cmd.Parameters.Add("#Date", SqlDbType.VarChar).Value = myTextBox22.Text;
cmd.Parameters.Add("#Description", SqlDbType.VarChar).Value = myTextBox33.Text;
cmd.Parameters.Add("#ID", SqlDbType.Int).Value = Convert.ToInt32(GV_InlineEditing.Rows(e.RowIndex).Cells(1).Text);
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
UPDATE
Add else conditions to Throw New Exception("myTextBox11 is null"); for myTextBox11, myTextBox22, and myTextBox33.
That will allow you to see if both:
GV_InlineEditing.Rows(0).FindControl("Date") as TextBox;
and:
GV_InlineEditing.Rows(0).Cells(0).FindControl("GV_Post_ID");
are failing.
I always do something like this like this:
protected void Gridview1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex];
int id = Int32.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());
TextBox date = (TextBox)row.FindControl("date");
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "update t_your_table " +
"set " +
"date = #date, " +
" time = #time where id = #ID "
cmd.Parameters.Add("#id", SqlDbType.VarChar).Value = id;
cmd.Parameters.Add("#date", SqlDbType.VarChar).Value = date.Text;
You have to get your datakeyname into the variables. That way it will use that field no matter what row is clicked.
Related
I want to select multiple item from checkbox list and then fill another check Box list on select index changed event of First check box list but after one selection its not working for another selected items because of "Auto Post Back = true" while debbuging i can see pointer start from page load event. I want after selection of all Item it should be fire "ddlregion_SelectedIndexChanged" so that I can able see all selected Item related value in another check Box List.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindRegion();
}
}
Due to this its not fetching data for another selected Items how to solve this issues Please help me.
ddlRegion Code Binding:
public void BindRegion()
{
OracleCommand Cmd = new OracleCommand("select * from regions", con);
Cmd.CommandType = CommandType.Text;
OracleDataAdapter da = new OracleDataAdapter();
DataSet ds = new DataSet();
da.SelectCommand = Cmd;
da.Fill(ds);
ddlregion.DataSource = ds;
ddlregion.DataTextField = "REGION_DESC";
ddlregion.DataValueField = "REGION_CODE";
ddlregion.DataBind();
}
Select Index Changed Event
protected void ddlregion_SelectedIndexChanged(object sender, EventArgs e)
{
ddlDepot.Items.Clear();
ddlDepot.Items.Add(new ListItem("--Select Depot--", ""));
foreach (ListItem item in ddlregion.Items)
{
if (item.Selected == true)
{
string str = "select d.depot_code, d.depot_description from regions r, sub_regions sr, depots d where r.region_code = sr.region_code and sr.sub_region_code = d.sub_region_code and active = 'Y' and r.region_code in " + ddlregion.SelectedValue + "";
OracleCommand Cmd = new OracleCommand(str, con);
Cmd.CommandType = CommandType.Text;
OracleDataAdapter da = new OracleDataAdapter();
DataSet ds = new DataSet();
da.SelectCommand = Cmd;
da.Fill(ds);
ddlDepot.DataSource = ds;
ddlDepot.DataTextField = "DEPOT_DESCRIPTION";
ddlDepot.DataValueField = "DEPOT_CODE";
ddlDepot.DataBind();
}
}
}
You need to build your region list for the SQL, then once done call your SQL and Bind.
string regions = "";
bool regionSelected = false;
foreach (ListItem item in ddlregion.Items)
{
if (item.Selected == true)
{
regions += item.SelectedValue + ",";
regionSelected = true;
}
}
// looping done so clean up string for SQL
regions = "(" + regions.TrimEnd(',') + " )";
//only run if a region is selected
if(regionSelected)
{
string str = "select d.depot_code, d.depot_description from regions r, sub_regions sr,
depots d where r.region_code = sr.region_code and
sr.sub_region_code = d.sub_region_code and active = 'Y' and r.region_code
in " + regions;
OracleCommand Cmd = new OracleCommand(str, con);
Cmd.CommandType = CommandType.Text;
OracleDataAdapter da = new OracleDataAdapter();
DataSet ds = new DataSet();
da.SelectCommand = Cmd;
da.Fill(ds);
ddlDepot.DataSource = ds;
ddlDepot.DataTextField = "DEPOT_DESCRIPTION";
ddlDepot.DataValueField = "DEPOT_CODE";
ddlDepot.DataBind();
}
I am working on asp.net project. I add one new page here and on that page i call multiple stored procedure. After executing this page for some time my site stops working and continue refreshing on browser without giving any error. After restarting the server it starts work again.
private void GetBiometrixData()
{
try
{
string data = string.Empty;
var length = ddlsession.Items.Count;
for (int i = 0; i < length; i++)
{
if (ddlsession.Items[i].Selected == true)
{
if (ddlsession.Items[i].Text != "--Select--")
{
data += ddlsession.Items[i].Text + ",";
}
}
}
data = data.Length > 0 ? data.Substring(0, data.Length - 1) : "";
data = data.Trim();
String strConnString = ConfigurationManager.ConnectionStrings["ak"].ConnectionString;
DateTime? FromDate = null;
DateTime? ToDate = null;
string session = "";
string TrainingType = "";
string EmployeeName = "";
string Course = "";
string Batch = "";
CultureInfo provider = CultureInfo.InvariantCulture;
string format = "MM/dd/yyyy";
if (string.IsNullOrEmpty(txtFromDate.Text.ToString()))
{
string TodayDate = DateTime.Now.ToString("MM/dd/yyyy");
FromDate = DateTime.ParseExact(TodayDate.ToString().Trim(), format, provider);
}
else
FromDate = DateTime.ParseExact(txtFromDate.Text.ToString().Trim(), format, provider);
if (string.IsNullOrEmpty(txtToDate.Text.ToString()))
ToDate = null;
else
ToDate = DateTime.ParseExact(txtToDate.Text.ToString().Trim(), format, provider);
if (ddlsession.SelectedItem.Text.ToString() == "--Select--")
session = null;
else
session = ddlsession.SelectedItem.Text.ToString();
if ((ddltrainingtype.SelectedItem.Text.ToString() == "--Select Training Type--"))
TrainingType = null;
else
TrainingType = ddltrainingtype.SelectedItem.Text.ToString();
if ((ddlCourse.SelectedItem.Text.ToString() == "--Select Course--"))
Course = null;
else
Course = ddlCourse.SelectedValue.ToString();
if ((ddlbatch.SelectedItem.Text.ToString() == "--Select Batch--"))
Batch = null;
else
Batch = ddlbatch.SelectedValue.ToString();
if (!string.IsNullOrEmpty(txtEmployeeName.Text.ToString()))
EmployeeName = txtEmployeeName.Text.ToString();
string strStatus = "";
if (Session["strStatus"] != null)
{
strStatus = Convert.ToString(Session["strStatus"]);
}
DataSet dsCount = new DataSet();
using (SqlConnection con = new SqlConnection(strConnString))
{
using (SqlCommand cmd = new SqlCommand())
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = con;
cmd.CommandTimeout = 0;
cmd.CommandText = "SP_GetBiometricAttendanceReport2";
cmd.Parameters.Add("#FromDate", System.Data.SqlDbType.DateTime).Value = FromDate;
cmd.Parameters.Add("#ToDate", System.Data.SqlDbType.DateTime).Value = ToDate;
cmd.Parameters.Add("#Session", SqlDbType.VarChar).Value = data;
cmd.Parameters.Add("#TrainingType", SqlDbType.VarChar).Value = TrainingType;
cmd.Parameters.Add("#Course", SqlDbType.VarChar).Value = Course;
cmd.Parameters.Add("#Batch", SqlDbType.VarChar).Value = Batch;
cmd.Parameters.Add("#EmployeeName", SqlDbType.VarChar).Value = EmployeeName;
cmd.Parameters.Add("#TotalStudents", SqlDbType.BigInt);
cmd.Parameters["#TotalStudents"].Direction = ParameterDirection.Output;
cmd.Parameters.Add("#TotalPresentStudents", SqlDbType.BigInt);
cmd.Parameters["#TotalPresentStudents"].Direction = ParameterDirection.Output;
cmd.Parameters.Add("#TotalAbsentStudents", SqlDbType.BigInt);
cmd.Parameters["#TotalAbsentStudents"].Direction = ParameterDirection.Output;
sda.SelectCommand = cmd;
sda.Fill(dsCount);
tblSummary.Visible = true;
lblTotalDrive.Text = cmd.Parameters["#TotalStudents"].Value.ToString();
lblTotalStudentAttended.Text = cmd.Parameters["#TotalPresentStudents"].Value.ToString();
lblTotalStudentAbsent.Text = cmd.Parameters["#TotalAbsentStudents"].Value.ToString();
}
}
}
DataSet ds = new DataSet();
using (SqlConnection con = new SqlConnection(strConnString))
{
using (SqlCommand cmd = new SqlCommand())
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
if (!string.IsNullOrEmpty(Convert.ToString(FromDate)) && !string.IsNullOrEmpty(Convert.ToString(ToDate)))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = con;
cmd.CommandTimeout = 0;
cmd.CommandText = "SP_GetBiometricAttendanceReportCount";
cmd.Parameters.Add("#FromDate", System.Data.SqlDbType.DateTime).Value = FromDate;
cmd.Parameters.Add("#ToDate", System.Data.SqlDbType.DateTime).Value = ToDate;
cmd.Parameters.Add("#Session", SqlDbType.VarChar).Value = data;
cmd.Parameters.Add("#TrainingType", SqlDbType.VarChar).Value = TrainingType;
cmd.Parameters.Add("#Course", SqlDbType.VarChar).Value = Course;
cmd.Parameters.Add("#Batch", SqlDbType.VarChar).Value = Batch;
cmd.Parameters.Add("#EmployeeName", SqlDbType.VarChar).Value = EmployeeName;
sda.SelectCommand = cmd;
sda.Fill(ds);
tblSummary.Visible = false;
GridView2.Visible = false;
RadGrid1.Visible = false;
GridView1.Visible = true;
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
//RadGrid1.DataSource = ds.Tables[0];
//RadGrid1.Rebind();
}
else
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = con;
cmd.CommandTimeout = 0;
cmd.CommandText = "SP_GetBiometricAttendanceReport";
cmd.Parameters.Add("#FromDate", System.Data.SqlDbType.DateTime).Value = FromDate;
cmd.Parameters.Add("#ToDate", System.Data.SqlDbType.DateTime).Value = ToDate;
cmd.Parameters.Add("#Session", SqlDbType.VarChar).Value = session;
cmd.Parameters.Add("#TrainingType", SqlDbType.VarChar).Value = TrainingType;
cmd.Parameters.Add("#Course", SqlDbType.VarChar).Value = Course;
cmd.Parameters.Add("#EmployeeName", SqlDbType.VarChar).Value = EmployeeName;
cmd.Parameters.Add("#Status", SqlDbType.VarChar).Value = strStatus;
cmd.Parameters.Add("#Batch", SqlDbType.VarChar).Value = Batch;
sda.SelectCommand = cmd;
sda.Fill(ds);
GridView2.DataSource = ds.Tables[0];
GridView2.DataBind();
RadGrid1.DataSource = ds.Tables[0];
RadGrid1.Rebind();
if (strStatus == "")
lblResultStatus.Text = "<strong>Result of Total Students >></strong>";
else
lblResultStatus.Text = "<strong>Result of Total " + strStatus + " Students >></strong>";
}
}
}
}
}
catch (Exception ex)
{
Response.Write(ex.Message);
//throw ex;
}
finally
{
con.Dispose();
con.Close();
}
}
Please help me to resolve this why site stops normal working and need to restart the server again and again.
Thanks...
I currently am using a listview to edit and update data. When I click edit it goes into the edit format that I want it to. I want to be able to exit the entire edit mode after the update button is clicked. Is this possible?
When I use ListView1.EditIndex = -1 it doesn't go back to the regular view.
protected void ListView1_ItemUpdating(object sender, ListViewUpdateEventArgs e)
{
updateButton = true;
ListViewItem lvl = ListView1.Items[e.ItemIndex];
var formTitleListBox = (ListBox)lvl.FindControl("ListBox1");
var controlTypeListBox = (ListBox)lvl.FindControl("ControlType");
var formSectionListBox = (ListBox)lvl.FindControl("formsection");
var sortOrderTextBox = (TextBox)lvl.FindControl("SortOrderTextBox");
var subsectionListBox = (ListBox)lvl.FindControl("subsection");
var subSectionTextBox = (TextBox)lvl.FindControl("SubSectionOrderTextBox");
var sectionItemListBox = (ListBox)lvl.FindControl("sectionitem");
var sectionSortOrderTextBox = (TextBox)lvl.FindControl("SectionSortOrderTextBox");
var validationRuleListBox = (ListBox)lvl.FindControl("RuleDesc");
var crossItemListBox = (ListBox)lvl.FindControl("CrossItem");
var hiddenID = (HiddenField)lvl.FindControl("HiddenPrimaryID");
using (SqlConnection connection = new SqlConnection("Data Source=RCK-HRSA-DB01;Initial Catalog=ORHP_Dev03182014;User ID=ohitrural;Password=0h!trural"))
{
try
{
SqlCommand cmd1 = new SqlCommand("UPDATE ORHP_Dev03182014.Core.Form_Section_SubSection_Item_Rel SET FormID = #FormTitle, FormSectionID = #FormSection, SubSectionID = #SubSection, SectionItemID = #SectionItem, SortOrder = #SortOrder, SectionSortOrder = #SectionSortOrder, SubSectionSortOrder = #SubSectionSortOrder, ValidationRulesetId = #RuleDesc, ControlTypeID = #ControlType, CrossItemID = #CrossItem WHERE DataCollectionPeriodID = " + DropDownList2.SelectedValue + " AND FormSectionSubSectionItemRelID = #FormSectionSubSectionID");
connection.Open();
cmd1.Connection = connection;
cmd1.CommandType = CommandType.Text;
cmd1.Parameters.AddWithValue("#FormTitle", formTitleListBox.SelectedValue);
cmd1.Parameters.AddWithValue("#ControlType", DbNullIfNull(controlTypeListBox.SelectedValue));
cmd1.Parameters.AddWithValue("#FormSection", formSectionListBox.SelectedValue);
cmd1.Parameters.AddWithValue("#SortOrder", DbNullIfNull(sortOrderTextBox.Text));
cmd1.Parameters.AddWithValue("#SubSection", subsectionListBox.SelectedValue);
cmd1.Parameters.AddWithValue("#SubSectionSortOrder", DbNullIfNull(subSectionTextBox.Text));
cmd1.Parameters.AddWithValue("#SectionItem", sectionItemListBox.SelectedValue);
cmd1.Parameters.AddWithValue("#SectionSortOrder", DbNullIfNull(sectionSortOrderTextBox.Text));
cmd1.Parameters.AddWithValue("#RuleDesc", DbNullIfNull(validationRuleListBox.SelectedValue));
cmd1.Parameters.AddWithValue("#CrossItem", DbNullIfNull(crossItemListBox.SelectedValue));
cmd1.Parameters.AddWithValue("#FormSectionSubSectionID", hiddenID.Value);
cmd1.ExecuteNonQuery();
SqlDataAdapter dt = new SqlDataAdapter(cmd1);
DataSet ds = new DataSet();
searchDS = new DataSet();
dt.Fill(ds);
searchDS = ds;
UpdatePanel1.Update();
ListView1.DataSource = searchDS;
ListView1.EditIndex = -1;
ListView1.DataBind();
e.Cancel = true;
}
catch (Exception ex)
{
}
}
}
Add ListView1.DataBind(); and also e.Cancel = true;.
// ...
cmd1.ExecuteNonQuery();
ListView1.EditIndex = -1;
ListView1.DataBind()
e.Cancel = true;
// ...
Side-note: remove the empty catch if you want to notice if something goes wrong.
I have a method that reads data from a database table using SqlDataReader.
i assign data retrieved by SqlDataReader into a List and return it.
when i want to assign the List data from method into the List on Code behind file,
i encounter the following error:
and here is my code
public List<string> displayCustoemrhShipOrder()
{
List<string> drList = new List<string>();
int i = 0;
string sConnectionString = ConfigurationManager.ConnectionStrings["LGDB"].ToString();
SqlConnection SqlCOn = new SqlConnection(sConnectionString);
SqlCommand SqlCmd = new SqlCommand();
SqlCmd.Connection = SqlCOn;
SqlCmd.CommandText = "displayCustomerShipOrder";
SqlCmd.CommandType = CommandType.StoredProcedure;
SqlCOn.Open();
SqlCmd.Parameters.AddWithValue("ShipOrderID",shipOrderID);
SqlDataReader reader = SqlCmd.ExecuteReader();
while (reader.Read())
{
drList.Insert(i, reader.GetValue(i).ToString());
i++;
}
//reader.Close();
//sqlCon.Close();
reader.Dispose();
SqlCOn.Dispose();
return (drList);
}
code behind code:
protected void Page_Load(object sender, EventArgs e)
{
// string shipOrderID = Session["shipOrderID"].ToString();
// int ID = Convert.ToInt32(shipOrderID);
int ID = 700;
Classes.CustomerShipOrder cuShipOrder = new Classes.CustomerShipOrder(ID);
List<string> ordrList = new List<string>(16);
ordrList= cuShipOrder.displayCustoemrhShipOrder();
cuid.Text = ordrList[0];
Label2.Text = ordrList[1];
Label3.Text = ordrList[2];
Label4.Text = ordrList[3];
Label5.Text = ordrList[4];
Label6.Text = ordrList[5];
Label7.Text = ordrList[6];
Label8.Text = ordrList[7];
Label9.Text = ordrList[8];
Label10.Text = ordrList[9];
Label11.Text = ordrList[10];
stored procedure used :
#ShipOrderID int
as
begin
select * from customerShipOrder where shipOrderID = #ShipOrderID;
end
im working on asp.net and c#.
I have a gridview populated from an sql database. I have dropdowlist and textbox controls.
On the RowDataBound event I have values asigned to controls:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Control ctrlgridEstacion = e.Row.FindControl("grid1");
if (ctrlgridEstacion != null)
{
DropDownList dd = ctrlgridEstacion as DropDownList;
SqlDataReader dr;
SqlCommand cmd;
cmd = new SqlCommand();
cmd.Connection = sqlConn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "sp_load";
sqlConn.Open();
dr = cmd.ExecuteReader();
DataTable dt = new DataTable();
dt.Load(dr);
dd.DataSource = dt;
dd.DataValueField = "code";
dd.DataTextField = "code";
dd.DataBind();
DataRowView rowView = (DataRowView)e.Row.DataItem;
string tempDate = rowView["code"].ToString();
dd.SelectedIndex = dd.Items.IndexOf(dd.Items.FindByText(tempDate));
sqlConn.Close();
}
Control gridPrefijo = e.Row.FindControl("grid2");
if (gridPrefijo != null)
{
TextBox dd = gridPrefijo as TextBox;
DataTable dt = new DataTable();
sqlConn.Open();
SqlCommand cmd;
cmd = new SqlCommand();
cmd.Connection = sqlConn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "sp_load";
SqlDataAdapter sqlDa = new SqlDataAdapter(cmd);
sqlDa.Fill(dt);
int startIndex;
if (c1 < 1)
{
int RC = dt.Rows.Count;
int PS = GridView1.PageSize;
int PN = GridView1.PageIndex + 1;
startIndex = (PN - 1) * PS;
int endIndex = Math.Min(RC - 1, startIndex + PS - 1);
dri = startIndex;
}
if (dt.Rows.Count > 0)
{
dd.Text = dt.Rows[dri ]["name"].ToString();
c1++;
}
sqlConn.Close();
}
}
}
The problem is that I have 15 controls, so adding them to the RowDatabound event is a lot of code.
How can I make the code smaller?
Thanks..