0
gridview 내부에 드롭 다운 목록이 있습니다. DDL의 값을 편집 모드에서보기 모드와 동일하게하지 않을 것입니다. 그리드 뷰가 편집 모드가되면 DDL 세트의 값이 기본값이됩니다.드롭 다운 목록의 값 설정 OnRowEditing
필자는 채우기 전에 gridview를 편집 모드로 바인딩하려고했지만 null (nFolderId)을 얻습니다. 바인딩 후 nFolderId 스니 j을 시도하면 기본값 (첫 x 째 값)을 얻게됩니다.
그렇다면보기 모드에서 편집 모드로 유지하기 위해 DDL 값을 얻으려면 어떻게해야합니까? 내 영문
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
GridViewRow row = GridView1.Rows[e.NewEditIndex];
var nFolderId = Convert.ToInt32(((DropDownList)row.FindControl("DropDownListFolders1")).SelectedValue);
FillGridView();
GridView1.DataBind();
}
:
<asp:GridView ID="GridView1" runat="server" OnRowEditing="GridView1_RowEditing" DataKeyNames="strPositionId,tmVaRPosition,nFoldersId"
AllowSorting="True" AutoGenerateColumns="False" SkinID="gridviewGridlinesSkin" OnRowCancelingEdit="GridView1_CancelingEdit"
OnRowUpdated="GridView1_RowUpdated" OnRowUpdating="GridView1_RowUpdating" OnRowDeleted="GridView1_RowDeleted" OnRowDeleting="GridView1_RowDeleting"
EmptyDataText="No positions found" OnRowDataBound="GridView1_RowDatabound">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="ibEdit" runat="server" AlternateText="Edit" CommandName="Edit"
ImageUrl="~/Images/icon_edit.gif" />
<asp:ImageButton ID="ibDelete" runat="server" AlternateText="Delete" CommandName="Delete"
ImageUrl="~/Images/icon_delete.gif" OnClientClick='<%# Eval("strPositionName", "return confirm(\"Are you sure you want to delete this entry {0}?\");") %>' />
</ItemTemplate>
<EditItemTemplate>
<asp:ImageButton ID="ibUpdate" runat="server" AlternateText="Update" CommandName="Update" ImageUrl="~/Images/icon_ok.gif" />
<asp:ImageButton ID="ibCancel" runat="server" AlternateText="Cancel" CommandName="Cancel" ImageUrl="~/Images/icon_cancel.gif" />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Eval("strFolderName") %>'></asp:Label>
</ItemTemplate>
<ItemStyle Wrap="False" />
</asp:TemplateField>
<asp:TemplateField>
<EditItemTemplate>
<BrummerComp:SortableDropDownList ID="DropDownListFolders1" Width="141px" runat="server"
SkinID="BCdropdownlistSkin"/>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
-보기 모드 편집 모드? – deostroll
@deostroll 뷰 모드에서 이것은 값을 보여주는 레이블 일뿐입니다 – MrProgram