Siva here.
I have used Default aspx page with bunch of link buttons in sidebar. Using asp panel i loaded the user control in panel. Here every thing is perfect. I can't highlight the active link button without post back.
ASP has a control called the Update panel (http://msdn.microsoft.com/en-us/library/bb386454(v=vs.100).aspx)
wich basicly allows you to call events while not using the postback trigger.
i hope this helps.
Related
What is difference between hyperlink control , link button , ImageButton , button control in ASP.NET. Which one to use when?
Let say I have requirement to show an image. On click of the image I need to do something. It can be done using above controls. Which one is better to use?
HyperLink is used to navigate, it renders to an anchor tag
LinkButton renders also to an anchor tag but with postback to server behavior. It's used to have a button with link look & feel.
ImageButton renders to an input control of type image and can be user to post to server or perform some client side action.
If you need to use that control to implement navigation, use HyperLink, otherwise you could use ImageButton
I have a page with an update panel, this page also has an ajax model popup. When I click some buttons I make some changes in code behind and then show the popup. For some reason when I click the button in the update panel no changes occur in the popup.
Debugging through the click I see that the changes are applied but the popup is not refreshed.
Any suggestions would be greatly appreciated.
You need to register a post back trigger so that the popup is completely refreshed. This is of course if you want the page to post back, otherwise if you want those changes to be reflected in the popup you will need to use javascript.
example:
asp:PostBackTrigger ControlID="UploadTemplateImageButton"
you have to set the panel visibility to false on page load.
ex: panel1.Visible=false;
I am using a ajaxToolkit:AsyncFileUpload that allows the user to upload a excel file. In the AsyncFileUpload1_UploadComplete() event, I am reading the excel data and creating excel structure using div and adding to the page. But these dynamically created controls are not being added to the page. I added a button in the updatepanel and checked. On button click event, I created same above controls. In this case, the controls are rendering to the page. The controls are not rendering in case of ajaxToolkit:AsyncFileUpload only. Can anybody please tell me what is the fix for this.
Add Button into UpdatePanel where you want to show new controls and make it invisible with css style.
In the AsyncFileUpload1_UploadComplete server-side method, save your data to Session state.
In the client-side OnClientUploadComplete event handler call __doPostBack function with hidden button's UniqueID first parameter value. Then make all stuff required to render dynamic content in that button's click handler.
Could someone help me out in getting a popup with a gridview(with 2 columns) inside when a link is clicked. I need some help badly. Can someone please tel me how to start and the procedure. I will be thankful.
2 columns in the gridview include checkbox and Text. This should get populated from database and after modifying that. it should save it in the database!!
I really appreciate all your help!! Thanks!
If you have no time, and you want things to work "magically"; go download Ajax Control Toolkit;
Drop a link in your markup that would open the grid; name it MyLink
Define the two column'ed GridView inside a Panel.
<asp:Panel runat="server" ID="pnlGrid"><asp:GridView ...></asp:Panel>
Drop ModalPopupExtender control from Ajax Control Toolkit in your markup.
Add Panel's id in ModalPopupExtender's markup
<act:ModalPopupExtender ID="MyModalPopupExtender1" runat="server" TargetControlID="MyLink" PopupControlID="pnlGrid" style="display:none" OkControlID="MyOkButton"/>
Now clicking on the MyLink would open the Popup with GridView inside; dont forget to add GridView.EmptyDataText property, so that you'd know when there are no records to show.
Last, but not least, upon your page load, load the data from your database, and assign it your GridView.DataSource
This article is a good start.
Enjoy!
Assuming you are using asp.net webforms, the easiest way to do this is to use the Microsoft Ajax Toolkit. With it you can create your panel control with the gridview and extend it with the modal popup extender. You will then hook up the link's click event to show the modal popup control (and any other databinding you need to do).
Thus when you click on the link, the panel will be displayed with the gridview.
If you are using Web Forms, an option would be to use the Ajax Control Toolkit's ModalPopup control. This control is very easy to add to a web forms page. It will allow you to extend the link with the modal and load the gridview in a panel that the modal popup will then display.
I have a composite server control that does quiet a number of things; one of which is to display a ModalPopup OnClick of a dynamically generated HtmlAnchor control.
I need to create this ModalPopupExtender control dynamically in my server control and trigger it from within.
I have been able to create it and trigger it from a button created at design time but not at runtime. This is as a result of the ID assign to the link is always not found by the ModalPopupExtender control.
I have tried assigning a static ID but no success. Can anyone help?
I figured it out. All i needed to do was recreate the HtmlAnchor control in the overridden CreateChildControls method on postback.
Thanks David for you concern.