データがテーブルからバインドされるドロップダウンリストがある場合、同じデータがドロップダウンリストに存在する別のGridV が表示されます。 データはC#のコードでバインドされていますが、編集することはできません。コードを介してグリッドビューでデータを編集できない
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
var userid = (Guid)Membership.GetUser().ProviderUserKey;
ClientAdminMultiView.SetActiveView(MasterFundsView);
List<T_W_Company> allowedCompanies = Source.aspnet_AdminUserClientMapping.Where(x => x.UserID == userid).Select(p => p.T_W_Company).ToList();
CompanyDropDown.DataSource = allowedCompanies;
CompanyDropDown.DataBind();
GridView1.DataSource = allowedCompanies;
GridView1.DataBind();
}
ClearErrors();
}
以下は、私はそれがテンプレートフィールドで 、GridViewのにデータをバインドしようとした私のASPコードです。
<asp:EntityDataSource ID="CompanyDataSource" runat="server" ConnectionString="name=ReportsEntities" ContextTypeName="Nirvana.Factory.ReportsDbModel.ReportsEntities" DefaultContainerName="ReportsEntities" EnableFlattening="False" EnableDelete="True" EnableInsert="True" EnableUpdate="True" EntitySetName="T_W_Company" OnDeleted="MasterFundsDataSource_Deleted" OnDeleting="MasterFundsDataSource_Deleting" OnInserted="MasterFundsDataSource_Inserted" OnInserting="MasterFundsDataSource_Inserting" OnUpdated="MasterFundsDataSource_Updated" OnUpdating="MasterFundsDataSource_Updating" AutoGenerateWhereClause="true"> <WhereParameters> <asp:ControlParameter Name="CompanyID" ControlID="CompanyDropDown" PropertyName="SelectedValue" DbType="Int64" /> </WhereParameters> </asp:EntityDataSource>
私は、ドロップダウンリスト用のテーブルから値を取得しています。私がGridViewにバインドしなければならない値。上記のコードを使用してデータのデータリストをバインドする場合、GridViewのデータを編集できません。あなたは私がどこでパラメータを使用してASPコードを介してデータをバインドするいくつかの方法を提案することができます。 –
残りのマークアップはどこにありますか?編集のためにGridViewを設定する必要があります。 –