How to navigate to a web form programmatically - c#

How I can navigate to a web form on button click?
I have a datagrid with user information. I want to open an asp.net web form in the same master pages content place holder, when the user clicks on a row .
Any advice?

Response.Redirect("secondpage.aspx"). This redirects to that page. Save the row number, id, etc. in the session state like Session["rowid"] = 1 or send it as a querystring like secondpage.aspx?rowid=23. You need to save the row information and get that rowid from the second page and load the information for that row.

whithin the button tag : PostBackUrl="~/TargetPage.aspx"

Related

Programmatically select page number

I have a JTable with multiple pages, and I'd like to be able to save the page the user is on in a session variable and automatically move the table to that page when they come back to it. Is there a way to change the page the JTable is on when it loads?
Looking through the code it does not appear there are any public methods to alter the page number, however you can do this as a workaround:
var pageNumberToChangeTo = 3;
$("#IDofMyTable").find(".jtable-goto-page select").first().val(pageNumberToChangeTo).trigger("change")

when I clicking on Back button of browser , it should go to the previous activity of the same page

I am using VS 2008,ASP.NET,C#.NET.
I have a report with drill down feature in grid in web application.
i am using a same webpage for different click options(account group,subgroup,head account) of the same report page.
Suppose I am in webpage accounts.aspx
Now I am opening this report rptDisplay.aspx.
When I click on the account group, grid is filled as group wise .
When clicking on subgroup , grid is filled as subgroup wise .
When clicking on Back button of Browser , then it redirects to accounts.aspx page.
This is the present scenario.
But my requirement is when I clicking on Back button of browser , it should go to the previous rptDisplay.aspx with group selection dat.
How can we implement this?
Thanks in advance
George N t
You have to invoke full page postback in button click (Account group or Sub group). Then if click back button in your browser in will redirect to previous page.

Multiple update Panel in Form

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.

Reload a Web Page Using C#

I have a web page that prompts for user input via DropDownLists in some table cells. When a selection is made the selection replaces the DropDownList so that the action can only be performed once. In the case that a change needs to be made I want to be able to click a button that reloads the page from scratch. I have Googled and Googled but I have not managed to find a way to do this.
Any advice is appreciated.
Regards.
Put a link on the page with the text "Reload" and the url the url of the page. It's perfectly valid to have a page with a link to itself.
If you don't like the link idea, use a standard Button and in the click event, use Response.Redirect to redirect to the current page.
You can set an OnClick for your button that resets each DropDownList's SelectedIndex to 0 instead of reloading the page from scratch. Alternatively, you can set a Response.Redirect([the page's url]) into the OnClick as is suggested here.

Calling server side function from client side

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>

Categories

Resources