c# - ASP.NET user control property in a repeater is null after postback -
It seems that many questions have been posted on this, but nobody cures my problem. I have a user control inside the repeater. User control has a public property with just a gator / setter. Databasing is fine on initial page load, but when selecting a filter from a dropdown menu, the first repeater binds properly, but the second repeater with user control appears to be zero for the property. So, on the actual code:
My two repeaters look like this:
& amp; asp: Repeater id = "rptTransactionVisual" runat = "server" OnItemDataBound = "rptTransactionVisual_ItemDataBound" & gt; & Lt; ItemTemplate & gt; & Lt;% # Eval ("TransactionAmount")% & gt; ^ - I did this for a discretion investigation - it always receives a price, even if a zero value is received under the transaction, I know that he is getting data source and databbound "runat =" server "/> & lt; ASP: repeater id =" rptTransactions "runat =" Server "OnItemDataBound =" rptTransactions_ItemDataBound "OnDataBinding =" rptTransactions_DataBinding "> & lt; / TD Gt; & lt; td & gt; & lt; ASP: literal id = "ltlTransactionAmount" runat = "server" /> gt; & lt; / td> & lt; td & gt; & lt; ap: literal id = "ltlTransactionType" runat = "server" /> Lt; / td> gt; & lt; td & gt; & lt; ap: literal id = "ltlSector" runat = "server" /> & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: Repeater & gt; I am binding the value of the top repeater for another data source Repeater sin CE are the same:
Secure zero rptTransactions_DataBinding (Object Sender, EventArgs ) {rptTransactionVisual.DataSource = rptTransactions.DataSource; RptTransactionVisual.DataBind (); This is a code relevant to user control, which works fine at the beginning, but after filtering, the transaction is always zero;
public transaction transaction {received; Set; } Secure Override Zero OnLoad (EventArgs e) {base.OnLoad (e); If return (transaction == blank); .... Here is the filtering code:
Secure void ddTransactionType_SelectedIndexChanged (Object Sender, EventArgs E) {var transactions = getChildPages (). Where (P = & gt; type P. transaction == DD Transaction type. Selected value). For the list & lt; Transaction page & gt; (); } RptTransactions.DataSource = Transactions; rptTransactions.DataBind (); // Database is always for list repeater, and I think the visual repeater is databbounding with the correct data source I have hit my head against the wall on it.
I still do not know why the original was a blank after postback, but I got it a little bit Work recycled by the working repeater ItemDataBound event.
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) {TransactionPage Transaction = (TransactionPage) e .emem.DataItem; Transaction Page Paradigm View = (Transaction Page Converter) page. Load Controls ("~ / View / Page / Partial / Transaction Page Page."); Visual.transaction = transaction; rptTransactionVisual.Controls.Add (Tomb); }
Comments
Post a Comment