How can I bind usercontrol within formview. If I not use usercontrol everythings work fine , when I move to inputs in usercontrol model binding is not working.
Asked
Active
Viewed 717 times
0
-
Do you have any code to share? – cspolton Oct 10 '12 at 12:06
1 Answers
0
Can you try this one as ascx control?
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MyGridView1.ascx.cs" Inherits="MyGridView1" %>
<asp:GridView ID="MyGridView" runat="server" SelectMethod="GetCustomers" PagerSettings-Position="Bottom"
AllowSorting="true" AllowPaging="true" PageSize="5" PagerSettings-Visible="true"
PagerSettings-Mode="NumericFirstLast" AutoGenerateDeleteButton="true" Caption="MyGridViewControl"
CellPadding="4" GridLines="None" ForeColor="#333333">
<AlternatingRowStyle BackColor="White"></AlternatingRowStyle>
</asp:GridView>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowModelStateErrors="true"
ShowValidationErrors="true" />`
And add SelectMethod in code behind of the control. Register <%@ Register Src="~/MyGridView1.ascx" TagPrefix="uc1" TagName="MyGridView1" %>
and use this control as <uc1:mygridview1 runat="server" id="MyGridView1" />

Anand
- 1,440
- 8
- 11
-
thanks for answer , but my scenario is different I have edit.aspx page and several usercontrol within edit.aspx and they are part of the whole.I wanted to take apart the entity – tolahs Oct 19 '12 at 09:15