asp.net - FormView on a Master Page can't see databound controls through ContentPlaceHolder boundary -


I have many equally structured formives in an attempt to avoid duplicate markup, I have created a master page Weave is included, and FormView is placed inside a FormPlaceHolder. Specific DataBound Control - The only thing that changes from page to page - then on that page that uses that master page.

So I have a master page that looks like this:

  & lt;% @ Master ...% & gt; ... & lt; Form runat = server & gt; ... & lt; Asp: formview runat = "server" ... & gt; & Lt; Edititemtemplate & gt; ... Too many common markups ... & lt; Asp: contentplaceholder id = 'FormRows' runat = 'server' / & gt; ... Too much general markup ... & lt; / Edititemtemplate & gt; & Lt; / ASP: FormView & gt; ... & lt; / Form & gt;  

and a page using the page that looks something like this:

  & lt;% @ page masterpagefile = "Form.Master". ..%> & Lt; Asp: content contentplaceholderid = "formrows" runat = "server" & gt; ... & lt; P & gt; Field One: & lt; Asp: textbox runat = server text = '& lt;% # bind ("field 1")%> Id = 'field1' / & gt; & Lt; / P & gt; & Lt; P & gt; Field two: & lt; ASP: Text Box Runat = Server Text = '& lt;% # Bind ("Field2")% & gt; Id = 'field2' / & gt; & Lt; / P & gt; ... & lt; / Asp: content & gt;  

With an existing record, the form looks through the VoV Datatound Control (Field 1, etc.) and shows them with the right data. But when inserting or updating, they do not see them, and they are not included in the inclusion or update. In the FormView_ItemInserting event, e.Values ​​ is empty; Similarly, FormView_ItemUpdating in the event, E. New value is empty.

Such:

  1. Is there a way to provoke form Vive on the master page to look through the DataBend control within the ContentPlaceholder?

  2. To deny it, there is a direct way to identify controls that are with the database & lt;% # bind (...)% & Gt; so that I manually add them to the price bag?

I think it will prove difficult, if not possible ; Actually I'm surprised that Databasing works at all!

You may want to use another method to encode your form-power control.

You are one. You can try to control the form control with placeholders where you now have content placeholder.

Then on each ASPX page, you can have a mirror ASCX page that includes the filler for the placeholder. You can give them the same name (page 1.spx page 1.can use scans) or Page 1-Content: Names like Cax can be established for the conference so that your FarmView esx can know what the control of the filler is, use the page. Load control () to load the control by path, and plug that content during the Init step.

Now, your content controls have the benefit of obtaining public properties, so that you can force those public properties, and even if the .ascx file contains data in the appropriate server controls and shuttle it goes.

Unfortunately, these files are doubled (due to the required ASPX and ASCX for each page) but quite a comparative alternative (all code repeats)

Of course, you It has not been told what all your normal markups are, but your general markup can also be found in a CommonMarkupHeader.ascx and CommonMarkupFooter.ascx and is included in the unique form of each page.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -