I am new Asp.net and working on project, where I have to ajaxify the basic asp.net
I have master page and content page. Master page has menu and buttons. The content page have various fieldsets as below.
Update Record Fieldset
Add Record Fieldset
Query and Grid.
updatepanel id=UpdatePanelOuter runat=server UpdateMode=Conditional> Likewise for all the nested UpdatePanels. The Scriptmanager is in Masterpage with EnablePartialRendering=true
What I have in code behind is ScriptManager1.RegisterAsyncPostBackControl(AddUpdatePanel) In button click event function AddUpdatePanel.Update() .
When the content page is loaded, I have the queryform and DataGrid. There are couple grid command like view, update and delete.
When I click update command from the grid, I am making UpdateFieldset.visible=true and QueryGridField.visible=false.
On submit button, its stored the data , give the message and go back to original contentpage with querygridFieldset.visible =true.
Question: What I am trying and have not been successfull is
when I click on the buttons, my datetime , menus in the master page
must not be refreshed.
On click in the Update button, only that particular Fieldset should
be sent to the server.
At the same time, I have updated by Web.config and there is no compilation error
Master Page: Menu, Current System Date time, Login Name, Buttons
Content Page: ContentPlaceHolder1 UpdateRecordFieldset AddRecordFieldset QueryandGridFieldset
Not sure what excalty is your requirement but if you have multiple update panels and master page and content page structure.
Please check the script manager and update panel properties according to this link:
http://www.asp.net/ajax/documentation/live/overview/updatepaneloverview.aspx
"Using UpdatePanel Controls in Master Pages" & "Using Nested UpdatePanel Controls" are titles in same link.
Hope this help.
Related
I have got an update panel in my master page.
in my child page i am trying to upload a file using fileupload control.
page is submitted using a link button called lnkSaveRequest. upon submission page throws a lnkComplete pop up button and think that is preventing my file from being uploaded.
when I try to add both lnkSaveRequest and lnkComplete in triggers
UpdatePanel updatePanel = Page.Master.FindControl("up") as UpdatePanel;
UpdatePanelControlTrigger trigger = new PostBackTrigger();
trigger.ControlID = lnkSaveRequest.UniqueID;
trigger.ControlID = lnkComplete.UniqueID;
updatePanel.Triggers.Add(trigger);
I get the following error
Control with ID 'lnkComplete' being registered through RegisterAsyncPostBackControl or RegisterPostBackControl must implement
either INamingContainer, IPostBackDataHandler, or
IPostBackEventHandler
if I remove the lnkComplete from trigger code , I don't get any error but the file doesnt get uploaded.
Any help much appreciated. or if anyone knows other ways of dealign with update panels in master page please help.
Check remark section in those links, read carefully.
http://msdn.microsoft.com/es-es/library/system.web.ui.postbacktrigger.postbacktrigger(v=vs.110).aspx
'Use the RegisterPostBackControl method of the ScriptManager control to programmatically register a postback control.
http://msdn.microsoft.com/es-es/library/system.web.ui.postbacktrigger%28v=vs.110%29.aspx
Sample postback trigger:
http://msdn.microsoft.com/es-es/library/system.web.ui.postbacktrigger%28v=vs.110%29.aspx
Got a very frustrating problem that I'm trying to solve regarding C#.NET's way of handling dynamically added usercontrols.
The basic rundown of my page setup is that I have an ASPX page which has a Master Page. The Master Page has some content placeholders. On the codebehind in the ASPX page, I call the Master.FindControl method to find the content placeholders, and then use the LoadControl method to load a UserControl into the placeholder.
On the UserControl, I have a series of textboxes, and a submit button. In this implementation, when I click on the submit button, and put a breakpoint into the OnClick event, I find that the OnClick event is never called.
However, if, instead of using this approach, I remove the Master Page, and add the content placeholders directly on the ASPX page, then use Placeholder.Controls.Add to add the UserControl instead of Master.FindControl, the button works perfectly.
Does anyone have any suggestions as to how I can resolve this without removing the Master Page?
I wanted to load a .aspx page into contentplaceholder without making a postback. What I have is a master page with 3 contentplaceholders
1.headerContent
2.leftContent
3.mainContent
I have 3 links in the headercontent and according to the selection of those 3 links, i'm showing few menu's on the leftcontent. On selecting any of the loaded menu on the left content i wanted to show/load a .aspx page inside the "maincontent" through the codebehind(C#), without making a refresh or postback. The .aspx pages which i wanted to load aren't inheriting the masterpage.
Other than using Iframes, is there any way to accomplish this??
What I can suggest is to use user controls (.ascx) instead of pages. Have one page that loads all the controls from the start, this page will use the master page and will have its content place holder as the mainContent.
You can have each control inside a div on the page, and set the display of the div to none. Then you can use java script to display just the relevant user control.
I am using Asp.Net/C# in my application.My current situation is that I am using Jquery tabs on one of my pages , I have tabs in the following order
Personal Details
Additional Details
Submit Data
Show Records
On the tab Show Records I am allowing the user to enter customer name whose records will be displayed in Asp.Net Gridview Control , The GridView is populated with the data on the click of an Asp.Net Button , My issue here is that when the user clicks the button , as it is a server control the page is refreshed and the Personal Details tab is shown and the the user needs to go to the tab Show Records to view the data in the Grid View.It shows the data from the database properly , but It is not what I need.When the button is clicked the tab Show Record should be visible.One solution I researched was to use Html button and call the function from client side.Can you guys suggest me some solution or using the html button is the best solution.
Thanks
append that code to your button click function on server-side
string script = "ShowRecordsTab();"
ScriptManager.RegisterStartupScript(this, this.GetType(), "RecordsTab", script, true);
and add this js code to your view
<script>
function ShowRecordsTab(){
$("li:last").click();
}
</script>
I have a master page. In that master page i have a user control which holds a Label control, it shows data read from a text file using marquee.
My text file changes every 2 minutes so I want to reload my user control every 2 minutes without effecting the master page.
How can i do that?
Any help is appreciated.
You could put the user control in an UpdatePanel and refresh the contents via an AsyncPostBack trigger as described in the following article:
http://www.asp.net/ajax/tutorials/understanding-asp-net-ajax-updatepanel-triggers
Here is one sluggish solution:
put the label control in a new page (with no master page) and add a timer with that label to refresh every 1 minute or so.
Now, go back to your master page and add an iframe with SRC pointing to the new page you created before. This way, all the refresh effect will be limited to the iframe only and not to your master page.
*Edit: you don't need a timer for the page inside the iframe. Just set the META refresh time period to whatever you want and in the code behind of that page, let the Page_Load event populate the label
UpdatePanel and use a Timer.
http://msdn.microsoft.com/en-us/library/cc295400.aspx