Я пытаюсь добавить DropdownList
в ретранслятором, но то, что я заменить вместо grdfilapprove
в этомвыпадающий внутри ретранслятора в asp.net
код
foreach (GridViewRow row in **GrdFileApprove**.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
DropDownList DropDownListcontrol =
row.FindControl("DropDownList4") as
DropDownList;
SqlCommand cmd = new SqlCommand("approveddd", mySQLconnection);
cmd.CommandType = CommandType.StoredProcedure;
Я обновляю мой вопрос это код кнопки
foreach (RepeaterItem row in Repeater2.Items)
//foreach (GridViewRow row in GrdFileApprove.Rows)
{
if (row.**RowType** == DataControlRowType.DataRow)
{
DropDownList DropDownListcontrol =
((DropDownList)**dataItem.**FindControl("DropDownList4"));
//DropDownList DropDownListcontrol = row.FindControl("DropDownList4")
as DropDownList;
SqlCommand cmd = new SqlCommand("approveddd", mySQLconnection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@DocID", SqlDbType.Int).Value =
Convert.ToInt32((row.Cells[1].Text));
cmd.Parameters.Add("@ApproveID", SqlDbType.Int).Value =
Convert.ToInt32(DropDownListcontrol.SelectedValue);
cmd.Parameters.Add("@ApproveBy", SqlDbType.VarChar, 50).Value =
(Session["Login2"]);
cmd.ExecuteNonQuery();
DMSLIB.Doc myDoc = new DMSLIB.Doc();
myDoc.MarkDocAs(Convert.ToInt16(row.**Cells**[1].Text),
Convert.ToInt32(DropDownListcontrol.SelectedValue));
}
else
{
apfi.Text = "Error";
}
}
сейчас, когда я использую это, покажу мне ошибку в этом
1. RowType error 'System.Web.UI.WebControls.RepeaterItem' does not contain a definition for 'RowType' and no extension method 'RowType' accepting a first argument of type
'System.Web.UI.WebControls.RepeaterItem' could be found (are you missing a using directive or an assembly reference?)
2. dataItem error the name 'dataItem' does not exist in the current context
3.Cells System.Web.UI.WebControls.RepeaterItem does not contain a definition for 'Cells' and no extension method 'Cells' accepting a first argument of type 'System.Web.UI.WebControls.RepeaterItem' could be found (are you missing a using directive or an assembly reference?)
4.Cells 'System.Web.UI.WebControls.RepeaterItem' does not contain a definition for 'Cells' and no extension method 'Cells' accepting a first argument of type 'System.Web.UI.WebControls.RepeaterItem' could be found (are you missing a using directive or an assembly reference?)
Thankx
Не уверен, что я понимаю ваш вопрос. Я предполагаю, что это должно быть то, что вы ищете http://stackoverflow.com/q/1432790/1236044 – jbl
ранее я использовал gridview, но теперь я использую повторитель, поэтому, когда я реализую повторитель, то что я заменяю этот grdfileapprove .. – user2931015
Извините, но даже хотя существует множество сходств, переход от GridView к Repeater - это не поиск и замена. Вы должны понять, как работает ретранслятор и сделать некоторый перенос (который должен привести вас к результату, аналогичному приведенному выше). – jbl