i am going to implement the collapsiblepane in my application but it is not getting any thing just two link buttons
this is my code
CollapsiblePanelExtender ID="CollapsiblePanelExtender1"
AutoCollapse ="False" AutoExpand ="false" ScrollContents ="true" TargetControlID ="mypanel"
Collapsed ="true" CollapsedSize ="0" ExpandedSize ="300"
ExpandControlID ="mylink" CollapseControlID ="mylink2"
CollapsedText ="Show Details..." ExpandedText ="Hide Details..." runat="server">
</cc1:CollapsiblePanelExtender>
<asp:Panel ID ="mypanel" runat ="Server" Visible ="False" >
<asp:TextBox ID="txt" runat ="server" ></asp:TextBox><br />
<asp:Button ID="btn" runat ="Server" Text ="Click" />
</asp:Panel>
<asp:LinkButton ID="mylink" runat ="Server" Text ="Mydetaails" OnClick="mylink_Click" ></asp:LinkButton>
<asp:LinkButton ID="mylink2" runat ="Server" Text ="HideMydetails" OnClick="mylink2_Click" ></asp:LinkButton>
I'm not sure but can see at least 2 problems:
You server tag of CollapsiblePanelExtender must be closed, so you have:
runat="server">
but it must be:
runat="server"/>
Did you recreate CSS classes? CollapsiblePanelExtender works by manipulating styles, so these styles must be present. Also look at note from ( http://www.asp.net/AJAX/AjaxControlToolkit/Samples/CollapsiblePanel/CollapsiblePanel.aspx ) "Note: CollapsiblePanel assumes that the standard CSS box model is being used ... so please use the !DOCTYPE declaration (as found at the top of this page and enabled by default for new ASP.NET pages) to specify that the page should be rendered in IE's standards-compliant mode."
Related
I have an asp.net web page where i have a checkbox control inside gridview control as under
<asp:GridView ID="grdMergeCoverage" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<input type="checkbox" id="chkSelectStream" onclick="OnSelectionChanged(this);"
testrunid='<%#DataBinder.Eval(Container.DataItem,"TestRunId") %>'
checked='<%#DataBinder.Eval(Container.DataItem,"CodeCoverageRequired") %>'
servername='<%#DataBinder.Eval(Container.DataItem,"ServerName") %>'
runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
And the OnSelectionChanged function is as under
function OnSelectionChanged(id)
{
alert(id.testrunid);
alert(id.servername);
alert(id.checked);
}
In IE8 , I am able to get the value for testrunid,servername while in IE 9, it is coming as NULL.
What is the problem and how can i get the value in all the cases?
To get custom attributes you should use the getAttribute method.
Like so: id.getAttribute("servername").
The way you used to get the value before is non-standard and not always supported.
you can add the asp checkbox and add the attribute to it on the gridview rowitembound event. it will fire....
I have an AJAX Accordion Control sitting on my Web Form. I have a Asp.Net Label sitting inside an Accordion Pane. I want to databind the text property of the label to a View Model I have running.
The Label Text Property never seems to databind with the View Model? It will work perfectly if I pull the label outside of the Accordion Pane, but not inside?
This works:
<asp:Label runat="server" Text='<%# Model.Program.NameVisible.ToString() %>' />
This does not:
<asp:AccordionPane ID="AccordionPane2" runat="server">
<Header>
Advanced Search
</Header>
<Content>
<asp:Panel ID="pnlAdvancedSearch" runat="server">
<table cellpadding="2" cellspacing="0" width="100%" runat="server">
<tr>
<td align="right">
<asp:Label runat="server" Text='<%# Model.Program.NameVisible.ToString() %>' />
</td>
</tr>
</table>
</asp:Panel>
</Content>
</asp:AccordionPane>
Any ideas or workarounds?
Thanks.
Update: This apparently does not work when nested inside any AJAX Controls. I have had the same issue with the binding not taking place inside a ModalPopUpExtender as well.
The DataBind of the Accordion control does not invoke DataBind for each of the explicitly defined, custom AccordionPane controls. It instead will build the panes, as per the answer provided by Jupaol, using templates.
In your example, you will need to explicitly call DataBind on the control you want bound, or on a parent which will invoke databinding on all children. So, in your example, calling pnlAdvancedSearch.DataBind() would suffice to bind your label, and any other controls within the search panel.
I feel it worthwhile to add, however, that it also seems like it would be simpler to replace your <asp:Label> control entirely with a simple:
<%: Model.Program.NameVisible.ToString() %>
I just found a way
First of all the Accordion control does support data binding:
The Accordion can also be databound. Simply specify a data source through the DataSource or DataSourceID properties and then set your data items in the HeaderTemplate and ContentTemplate properties.
Source
Example:
Output
ASPX
<ajax:Accordion runat="server" ID="ajax22" RequireOpenedPane="true"
HeaderCssClass="accordionHeader"
HeaderSelectedCssClass="accordionHeaderSelected"
ContentCssClass="accordionContent"
>
<ContentTemplate>
Even cooler content
<br />
<asp:Label Text='<%# DataBinder.Eval(Container.DataItem, "Something") %>' ID="lbl" runat="server" />
</ContentTemplate>
<HeaderTemplate>
Cool header
<br />
<asp:Label Text='<%# DataBinder.Eval(Container.DataItem, "Something") %>' ID="lbl" runat="server" />
</HeaderTemplate>
</ajax:Accordion>
ASPX code behind
You need to specify the Accordion.DataSource property, this property only supports IEnumerable or IListSource, therefore you would need to bind your accordion as follows:
this.ajax22.DataSource = new[] { this.Model };
this.DataBind();
Model
public class MyModel
{
public MyModel()
{
this.Something = "plop!";
}
public string Something { get; set; }
}
When you bind your Accordion, a number of AccordionPanes are created to represent each bound item.
If you specify additional custom AccordionPanes, when you apply binding as specified above, these AccordionPanes will be ignored and won't be rendered.
I am trying to use AJAXControlToolkit’s Modelpopu with ConfirmDialog.I am using VS2008. Following is my code
<asp:Button ID="btnSave" runat="server" Text="Save" onclick="btnSave_Click" />
<asp:ConfirmButtonExtender ID="btnSave_ConfirmButtonExtender" runat="server"
ConfirmText="Want to Save?" Enabled="True" TargetControlID="btnSave">
</asp:ConfirmButtonExtender>
<asp:ModalPopupExtender ID="btnSave_ModalPopupExtender" runat="server"
DynamicServicePath="" Enabled="True" TargetControlID="btnSave">
</asp:ModalPopupExtender>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
Please guide me what should I do to make it run.
From the AJAX Control Toolkit documentation for the ConfirmButtonExtender:
http://www.asp.net/ajax/ajaxcontroltoolkit/samples/ConfirmButton/ConfirmButton.aspx
DisplayModalPopupID - Optionally specifies the ID of a ModalPopup control to use for displaying the confirmation dialog (instead of window.confirm). When using DisplayModalPopupID, the following conditions must be met:
The ModalPopup must be configured to work against the same TargetControlID as the ConfirmButton (and should work properly if the ConfirmButton is disabled).
The ModalPopup must specify OkControlID and/or CancelControlID to identify the buttons corresponding to window.confirm's OK/Cancel buttons.
The ModalPopup must not specify OnOkScript or OnCancelScript.
Example of using the AJAX controls together in your page:
<asp:ConfirmButtonExtender ID="btnSave_ConfirmButtonExtender" runat="server"
ConfirmText="Want to Save?" TargetControlID="btnSave"
DisplayModalPopupID="btnSave_ModalPopupExtender"></asp:ConfirmButtonExtender>
<asp:ModalPopupExtender ID="btnSave_ModalPopupExtender" runat="server"
TargetControlID="btnSave" PopupControlID="Panel1"
OkControlID="btnOK" CancelControlID="btnCancel"></asp:ModalPopupExtender>
Where Panel1 is an <asp:Panel> that gets displayed as the modal dialog, and btnOK and btnCancel are the OK and Cancel buttons on that panel.
I've a problem with asp:image and asp:imagebutton alternate text: it's not visible when I move the mouse over the image. I declared the object in that way:
<asp:ImageButton ID="ButtonStatus"
ImageUrl='<%# IIF(Eval("Active")=1,"../images/folders/actived.png","../images/folders/deactivate.png")%>' CommandName="ChangeStatus" CommandArgument='<%# Eval("id_repository") %>' OnCommand="FolderCommand"
Enabled = '<% #iif(mySecurity.Admin=1, "True", "False") %>' Width="24px" AlternateText="Change the status"
runat="server" />
and for asp:image
<asp:HyperLink runat="server" ID="url_groups" NavigateUrl="~/action/Group_manager.aspx?action=2">
<asp:Image id="img_groups" runat="server" ImageUrl="~/Images/folders/group_config.png" AlternateText="Group manager"
EnableViewState="false" ImageAlign="Middle" Width="32px" CssClass="navigation" />
</asp:HyperLink>
Could you help me? I tried to search on web but I wasn't able to find any post or suggestion to fix that problem
thanks,
Andrea
It's browser dependent whether the alt text gets shown when you mouse over an image. If you set the ToolTip parameter on a .NET Image or ImageButton it will render a title attribute which shows across pretty much every browser.
Here's an example from a site I'm currently working on:
<asp:HyperLink ID="ReplyLink" runat="server" NavigateUrl='<%# Eval("SrcAddr", "~/msp/send.aspx?to={0}") %>'>
<asp:Image ID="ReplyIcon" runat="server" ImageUrl="~/images/email_go.png" AlternateText="Reply" ToolTip="Reply" />
</asp:HyperLink>
I think you're mixing up the alt attribute with the title attribute. Alt is shown when the user doesn't accept images and for screen readers whereas the title attribute is shown as tool tip when you hover the image.
For example, i have this ImageViewer.ascx UserControl:
<div class="ImageTumbnails">
<asp:ListView ID="ImageList" runat="server" ItemPlaceholderID="ItemContainer">
<LayoutTemplate>
<asp:PlaceHolder ID="ItemContainer" runat="server" />
</LayoutTemplate>
<ItemTemplate>
<asp:HyperLink runat="server"
NavigateUrl='<%# Link.ToProductImage(Eval("ImageFile").ToString())%>'>
<asp:Image runat="server" ImageUrl='<%# Link.ToThumbnail(Eval("ImageFile").ToString()) %>' />
</asp:HyperLink>
</ItemTemplate>
</asp:ListView>
</div>
<div class="ImageBig">
<asp:Image ID="ProductImageBig" runat="server" ImageUrl="" />
</div>
When the thumbnail is clicked it will change the source of ProductImageBig with its hyperlink target.
How can i achieve this using UpdatePanel ? ( Or will i be able to )
You are currently using a HyperLink control which will direct the user to the value of the NavigateUrl property. If it goes to a separate page, how will it modify the URL of the ProductImageBig control?
One option is to change the HyperLink control to a ImageButton and then specify a method in your codebehind for the "OnCommand" property.
In the code behind, you can cast the sender object to a the ImageButton, retrieve its ImageURL, and then set the URL of your ProductImageBig
public void DisplayPhoto(object sender, CommandEventArgs args)
{
ProductImageBig.NavigateUrl = ((ImageButton)sender).ImageUrl;
updatePanel.Update();
}
If you have the entire markup surrounded in an UpdatePanel named "updatePanel" and you have the properties set correctly, you can then update it after setting the Url.