I have accordion control and having set of link button controls inside accordion control. I use the following code.
<asp:Accordion ID="Accordion1" Class="accordion" HeaderCssClass="accordionHeader"
HeaderSelectedCssClass="accordionHeaderSelected"
ContentCssClass="accordionContent" runat="server" Width="248px">
<Panes>
<asp:AccordionPane ID="AccordionPane1" runat="server">
<Header>Registration</Header>
<Content>
<asp:LinkButton ID="CandidateRegistration" CssClass="linkButton"
runat="server" ForeColor="Black"
OnClick="candidatesRegistration_Click"
Text="Candidates Registered"></asp:LinkButton><br />
<asp:LinkButton ID="registrationByRqp" runat="server"
ForeColor="Black" OnClick="registrationByRqp_Click"
Text="Registered Through RQP"></asp:LinkButton><br />
<asp:LinkButton ID="registrationByUi" runat="server"
ForeColor="Black" OnClick="registrationByUi_Click"
Text="Registered Through UI"></asp:LinkButton><br />
<asp:LinkButton ID="avgRegistration" runat="server"
ForeColor="Black" OnClick="avgRegistration_Click"
Text="Average Registration"></asp:LinkButton><br />
<asp:LinkButton ID="jobsRegistered" runat="server"
ForeColor="Black" OnClick="jobsRegistered_Click"
Text="Jobs registered"></asp:LinkButton><br />
<asp:LinkButton ID="unregistered" ForeColor="Black"
runat="server" Text="Unregistered Candidate"
OnClick="unregistered_Click"></asp:LinkButton>
</Content>
</asp:AccordionPane>
<asp:AccordionPane ID="AccordionPane2" runat="server">
<Header>Job Alerts</Header>
<Content>
<asp:LinkButton ID="jobAlert" runat="server" ForeColor="Black"
OnClick="jobAlert_Click">Job Alert</asp:LinkButton><br />
<asp:LinkButton ID="minScoreAlerts" runat="server"
ForeColor="Black" OnClick="minScoreAlerts_Click">
Minimum score of job alerts</asp:LinkButton><br />
<asp:LinkButton ID="maxScoreAlerts" runat="server"
ForeColor="Black" OnClick="maxScoreAlerts_Click">
Maximum score of job alerts</asp:LinkButton><br />
<asp:LinkButton ID="avgScoreJobAlerts" runat="server"
ForeColor="Black" OnClick="avgScoreJobAlerts_Click">
Average score of daily alerts</asp:LinkButton><br />
</Content>
</asp:AccordionPane>
<asp:AccordionPane ID="AccordionPane4" runat="server">
<Header>Analysis</Header>
<Content>
<asp:LinkButton ID="searchpeakTime" runat="server"
ForeColor="Black" OnClick="searchpeakTime_Click">
Search peak time</asp:LinkButton><br />
<asp:LinkButton ID="userActivityReport" runat="server"
ForeColor="Black" OnClick="userActivityReport_Click">
User Activity Report</asp:LinkButton><br />
<asp:LinkButton ID="operationalusage" runat="server"
ForeColor="Black" OnClick="operationalusage_Click">
Operational Usage</asp:LinkButton>
</Content>
</asp:AccordionPane>
<asp:AccordionPane ID="AccordionPane3" runat="server">
<Header>Overview</Header>
<Content>
<asp:LinkButton ID="Overview" ForeColor="Black" runat="server"
OnClick="Overview_Click" >Overview</asp:LinkButton><br />
</Content>
</asp:AccordionPane>
</Panes>
</asp:Accordion> <br />
.Its works properly . But when i click the the link button in the second or third accordion pane the page will be redirected but the visibility return to accordionpane1. I want which link button i click meaks the corresponded accordion pane will be visible and not the first . Can anyone able help for that?
Thankx in advance......
I think you can use "AutoSize="Fill"" property to achieve that. Have look at this question, it will solve your problem.
Related
I have a problem with placing RequiredFieldValidator into a DataList, and some assistance would be greatly appreciated.
Problem description:
When I place the <asp:RequiredFieldValidator>inside the <ItemTemplate> and run the page I get the following error page:
When I place it outside of it, the page works with no error, but obviously it cannot identify witch <asp:TextBox> does not have content in it, before it is posted back. And I would like to make where it is able to tell if a particular text box in the data list does not have text entered.
Here is the markup: (the Image src attribute is not implemented yet)
<asp:DataList ID="imageUploadRoster" runat="server"
DataSourceID="ImageUploadRosterDataSource" RepeatDirection="Horizontal" RepeatColumns="5" HorizontalAlign="Left">
<HeaderTemplate>
<h3>Set Image Names</h3>
</HeaderTemplate>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Height="180px" Width="180px" />
<ItemTemplate>
<div class="imageSetNameDiv">
<asp:HiddenField ID="ImageId" runat="server" Value='<%# Eval("ImageId") %>' />
<asp:HiddenField ID="ImageMimeTypeLabel" runat="server" Value='<%# Eval("ImageMimeType") %>' />
<asp:Image ID="ImageThumbnailLabel" runat="server" Src='<%# Eval("ImageThumbnail") %>' Width="120px" Height="120px" />
<br />
<asp:RequiredFieldValidator ID="imageNameRequired" runat="server"
ControlToValidate="ImageName" ErrorMessage="RequiredFieldValidator"
ValidationGroup="imageUploadValid">
</asp:RequiredFieldValidator>
<asp:TextBox ID="ImageName" runat="server" Text='<%# Eval("ImageName") %>' />
<br />
<hr />
<asp:Button ID="removeImage" runat="server" Text="Remove" CommandName="delete" CommandArgument='<%# Eval("ImageId") %>' />
</div>
</ItemTemplate>
</asp:DataList>
Thank you in advance for any assistance.
Peter
This error happens when ASP.NET encounters two controls with the same ID on the page. I guess for some reason in your case validators for each item get the same ID. Setting the following property:
ClientIDMode="Predictable"
for validator should fix it. This mode makes sure control in databound context gets correct ID.
I am trying to load images from the folder UploadImages combined with image name for the particular query
my gridview code is as follows:
<asp:GridView ID="gvDetails" runat="server" AllowPaging="false" PageSize="50" ShowHeader="false" GridLines="None" AutoGenerateColumns="false" Width="100%" OnPageIndexChanging="gvDetails_PageIndexChanging">
<PagerSettings Mode="NumericFirstLast" PageButtonCount="4" FirstPageText="First" LastPageText="Last" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<h2><asp:Label runat="server"><%#Eval("Ads_Title")%></asp:Label></h2>
<h5><asp:Label runat="server" Text='<%#Eval("Ads_Posted_Date")%>'></asp:Label>, Posted by <asp:Label runat="server" Text='<%#Eval("Ads_State")%>'></asp:Label></a></h5>
<div class="blog-para">
<p class="para">
<image src='../UploadImages/<%#Eval("Busines_Image") %>' Width="150px" />
<p><asp:Label runat="server" Text='<%#Eval("Cat_Name")%>'></asp:Label></p>
<p>Pokect Listing: <asp:Label runat="server" Text='<%#Eval("PocketListing")%>' /> </p>
<p><asp:Label Text='<%# Eval("Ads_Hot_Normal") == "false" ? "<image src='images/premium_logo.png' alt='Premium'" : " " %>'runat="server" /></p>
<div class="read_more">
<a class="btn" href='AdsDetails.aspx?AddId=<%#Eval("main_ID") %>'>Read More</a>
</div>
</p>
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Every time i run the webapp it states faied to load the resource.
This is might be happening because GridView control is losing View. For more details yo can try this Link
There is already half developed Web page. In which there are 4 RadTabs. On particular tab click, related Panel will open below.
Now, I have to add one more Tab named as "Invoice" and have to open a panel on tab click.
When I try to add new Tab and then click on Tab, it does not open any panel below.
Below is the demo code I tried but no luck.
<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
<Windows>
<telerik:RadWindow ID="rwBilling" Title="ITSSC Billing" runat="server" ReloadOnShow="true" Modal="true"
ShowContentDuringLoad="false" Animation="Fade" Width="480px" Height="480px"
EnableEmbeddedSkins="False" Skin="MetroRed" />
</Windows>
</telerik:RadWindowManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Transparency="20"
Width="100%" Height="100%">
<asp:Image ID="Image1" runat="server" ImageAlign="Middle"></asp:Image>
</telerik:RadAjaxLoadingPanel>
Demo
<br />
<telerik:RadTabStrip ID="RadTabStrip1" runat="server" EnableEmbeddedSkins="False" OnClientTabSelected="OnClientTabSelected"
Skin="MetroRed" MultiPageID="RadMultiPage1" SelectedIndex="0" CssClass="tabStrip"
Width="100%">
<Tabs>
<telerik:RadTab Text="Service Proposals" Selected="True">
</telerik:RadTab>
<telerik:RadTab Text="Advance Search">
</telerik:RadTab>
<telerik:RadTab Text="Section Revenue Report">
</telerik:RadTab>
<telerik:RadTab Text="Generate Invoices">
</telerik:RadTab>
</Tabs>
</telerik:RadTabStrip>
<telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" Width="100%">
<telerik:RadPageView ID="RadPageView1" runat="server" Width="100%" BorderStyle="Groove"
BorderColor="Red" BorderWidth="1px">
Test
</telerik:RadPageView>
<telerik:RadPageView ID="RadPageView2" runat="server" Width="100%" BorderStyle="Groove"
BorderColor="Red" BorderWidth="1px">
Test 1
</telerik:RadPageView>
<telerik:RadPageView ID="RadPageView3" runat="server" Width="100%" BorderStyle="Groove"
BorderColor="Red" BorderWidth="1px">
Test 2
</telerik:RadPageView>
<telerik:RadPageView ID="RadPageView4" runat="server" Width="100%" BorderStyle="Groove"
BorderColor="Red" BorderWidth="1px">
Test 3
</telerik:RadPageView>
I am very new in Telerik, so please let me know the solution of this. I am not getting how to achieve this. Please reply
Thanks in advance.
I solved it. Due to missing "Orientation" Property, it was not working.
<telerik:RadTabStrip Orientation="HorizontalTop"
Obviously I am doing something wrong, just not sure what...
I have a modal popup and inside of that is an Update Panel which in turn contains a gridview. When the modal popup is first called I would like to refresh the UpdatePanel (and grid data).
I have the code working so that the panel is updated when a button is pressed btnHiddenJSRefresh (currently not hidden). But I can not get this to work without having to press the button!
I've tried 'clicking' the button via Jquery $("<%= btnHiddenJSRefresh.ClientID %>").click();
And I can see it gets called, but there is no reaction on the page.
Same with __doPostBack("<%= btnHiddenJSRefresh.ClientID %>", "");
Also (and this may be unrelated) the delete option in the gridview does not work here. Outside of the UpdatePanel it works fine...
Here's the code, I've tried to reduce it down to the main area of issue
<ajaxact:modalpopupextender id="ModalPopupExtender1" runat="server"
cancelcontrolid="ClosePopup" okcontrolid="ClosePopup"
targetcontrolid="hidenSelectedDoc" popupcontrolid="THolder"
popupdraghandlecontrolid="PopupHeader" drag="true" BehaviorID="MPE" Y="0" backgroundcssclass="ModalPopupBG">
<div classs="ModalPopup" id="THolder" >
<a id="ClosePopup" href="#">Close</a>
<asp:Button ID="btnHiddenJSRefresh" runat="server" Text="Button" UseSubmitBehavior="false" OnClick="btnAddTag_Click" />
<asp:UpdatePanel ID="UpdatePanel2" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional" OnLoad="UpdatePanel2_Load" >
<ContentTemplate>
<asp:GridView ID="gvPageTags" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSourcePageTags" CssClass="TableDataHolder" DataKeyNames="CarID" >
<Columns>
<asp:BoundField DataField="FullName" HeaderText="Full Name" SortExpression="FullName" />
<asp:TemplateField HeaderText="Delete">
<ItemTemplate>
<asp:ImageButton ID="deleteButtonImg" runat="server" CommandName="Delete" Text="Delete" OnClientClick="return confirm('Are you sure you want to delete this car?');" ImageUrl="~/images/icons/DeleteIconS.png" AlternateText="Delete" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<asp:SqlDataSource ID="SqlDataSourcePageTags" runat="server"
ConnectionString="<%$ ConnectionStrings:bobConnectionString %>"
SelectCommand="SELECT * FROM Cars WHERE (cMake = #cMake)"
DeleteCommand="DELETE * FROM Cars WHERE CarID = #CarID">
<SelectParameters>
<asp:Parameter Name="cMake" DefaultValue="0" Type="int32" />
</SelectParameters>
</asp:SqlDataSource>
</div>
Code behind
protected void btnAddCar_Click(object sender, EventArgs e)
{
SqlDataSourcePageTags.SelectParameters["cMake"].DefaultValue = hidenSelectedcMake.Value;
SqlDataSourcePageTags.DataBind();
gvPageTags.DataBind();
UpdatePanel2.Update();
}
Any ideas would be great.
Thanks
It would be more helpful to have all the page code that is referenced in your code fragment. In the meantime, I tried to simulate this functionality from your description, so please correct me if I misunderstood something.
On the page load, I added a javascript block to check if it is a postback. If it is not, then I call the button's (btnHiddenJSRefresh) click event once to refesh the modal. Also, I added a button to popup the modal window, see my code example. And finally, the delete option is working fine in this example.
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Release">
<Scripts>
<asp:ScriptReference Path="resources/jquery-1.11.0.js"/>
</Scripts>
</asp:ScriptManager>
<script type="text/javascript">
$(document).ready(function () {
var chkPostBack = '<%= Page.IsPostBack ? "true" : "false" %>';
if ( !Boolean.parse(chkPostBack) ) {
__doPostBack("<%= btnHiddenJSRefresh.ClientID %>", "");
}
});
</script>
<asp:Button ID="shwmodal" runat="server" Text="show modal"
onclick="shwmodal_Click" />
<div classs="ModalPopup" id="THolder" >
<a id="ClosePopup" href="#">Close</a>
<asp:Button ID="btnHiddenJSRefresh" runat="server" Text="Button" style="display:none" OnClick="btnAddTag_Click" />
<asp:UpdatePanel ID="UpdatePanel2" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional"
OnLoad="UpdatePanel2_Load" >
<ContentTemplate>
<asp:GridView ID="gvPageTags" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSourcePageTags" CssClass="TableDataHolder" DataKeyNames="RoleID" >
<Columns>
<asp:BoundField DataField="Descr" HeaderText="Descr Name" SortExpression="Descr" />
<asp:TemplateField HeaderText="Delete">
<ItemTemplate>
<asp:ImageButton ID="deleteButtonImg" runat="server" CommandName="Delete" Text="Delete" OnClientClick="return confirm('Are you sure you want to delete this car?');" ImageUrl="~/images/icons/DeleteIconS.png" AlternateText="Delete" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<asp:SqlDataSource ID="SqlDataSourcePageTags" runat="server"
ConnectionString="<%$ ConnectionStrings:bobConnectionString %>"
SelectCommand="SELECT * FROM testRoles WHERE (RoleId = #cMake)"
DeleteCommand="DELETE FROM testRoles WHERE RoleId = #RoleId">
<SelectParameters>
<asp:Parameter Name="cMake" DefaultValue="0" Type="int32" />
</SelectParameters>
</asp:SqlDataSource>
</div>
<cc1:ModalPopupExtender id="ModalPopupExtender1" runat="server"
cancelcontrolid="ClosePopup" okcontrolid="ClosePopup"
targetcontrolid="hidenSelectedDoc" popupcontrolid="THolder"
popupdraghandlecontrolid="PopupHeader" drag="true" BehaviorID="MPE" Y="0" backgroundcssclass="ModalPopupBG">
</cc1:ModalPopupExtender>
<asp:Button runat="server"
ID="hidenSelectedDoc"
style="display:none"/>
</form>
I am currently developing an ASP.net c# application. I have a grid view which has bound link buttons inside. When the link button is pressed I want to display the modal popup using a fade in animation and a fade out animation when a button inside the modal popup is clicked.
I have added the animation extender into the code and set the TargetControlID to the ID of the link button, however, when I try to run the website it displays the error System.InvalidOperationException the TargetControID of ModalPopupExtender is not valid. A control with ID 'sofLink' could not be found. sofLink is the ID of the LinkButton.
Below is the code for the grid view
<asp:GridView ID="tblSoftware" runat="server" Width="100%"
EnableModelValidation="True" AutoGenerateColumns="False"
onselectedindexchanged="tblSoftware_SelectedIndexChanged"
CellPadding="2">
<Columns>
<asp:TemplateField HeaderText="Software Name">
<ItemTemplate>
<asp:LinkButton ID="sofLink" Text='<%# Bind("sof_softwareName") %>'
CommandName="sofID" OnCommand="GetSoftwareModal" CommandArgument='<%# Eval("sof_id") %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="sof_platform" HeaderText="Platform" ReadOnly="True" SortExpression="sof_platform" />
</Columns>
<HeaderStyle CssClass="gridHeader" />
<PagerSettings Position="Bottom" />
<PagerStyle HorizontalAlign="Right" VerticalAlign="Middle" CssClass="gridPage" />
<AlternatingRowStyle BackColor="White"></AlternatingRowStyle>
</asp:GridView>
And below is the code for the ModalPopupExtender
<ajaxToolkit:ModalPopupExtender ID="mpe" runat="server" TargetControlID="sofLink"
PopupControlID="ModalPanel" DropShadow="true" Drag="true" OkControlID="OKButton" />
<asp:Panel ID="ModalPanel" runat="server" Width="500px" style="width: auto; height: auto;" CssClass="modalPopup">
<asp:Label ID="softwareTitle" Font-Bold="true" Font-Size="Medium" runat="server" Width="100%" style="text-align: center;" /><br /><br />
<asp:Literal ID="litSoftware" runat="server"></asp:Literal>
<asp:Button id="OKButton" runat="server" Text="Close" style="position: relative; right: 0px; width: 100px;" />
</asp:Panel>
<asp:ScriptManager ID="asm" runat="server" />
And below is the code for the animation
<ajaxToolkit:AnimationExtender ID="popupAnimation" runat="server"
TargetControlID="sofLink">
<Animations>
<OnClick>
<Parallel AnimationTarget="ModalPanel"
Duration="0.3" Fps="25">
<FadeIn />
</Parallel>
</OnClick>
</Animations>
</ajaxToolkit:AnimationExtender>
Thanks for any help you can provide.
The TargetControlID (as far as I am aware) should be a control in the popup panel itself, not in the grid control. When I use the ModalPopupExtender I usually use an asp:Button with 'display:none' as the TargetControlID. Eg,
<ajaxToolkit:ModalPopupExtender ID="mpe" runat="server" TargetControlID="btnPopup"
PopupControlID="ModalPanel" DropShadow="true" Drag="true" OkControlID="OKButton" />
<asp:Panel ID="ModalPanel" runat="server" Width="500px" style="width: auto; height: auto;" CssClass="modalPopup">
<asp:Button id="btnPopup" runat="server" style="display:none" />
In the code-behind you have to control the showing and hiding of the control base on an event, eg, GetSoftwareModal. You will also also to bind what you need if applicable.
Hope that helps.
You could use a hidden button and use it's ID as TargetControlID of the ModalPopupExtender.
<asp:Button id="btnShowPopup" runat="server" style="display:none" />
Then you can call the button's click clientside if you want to show the popup immediately without postback in the follwoing way:
<asp:LinkButton ID="sofLink" runat="server" OnClientClick="javascript:document.getElementById('btnShowPopup').click();return false;">LinkButton</asp:LinkButton>
I tried however my animation doesn't display.
I add databind into LinkButton:
<asp:LinkButton ID="sofLink" runat="server" OnClientClick="javascript:document.getElementById('DetailView1').databind();document.getElementById('btnShowPopup').click();return false;">LinkButton</asp:LinkButton>
I think because of databind of DetailView1, it need get data from database. If DetailView1 doesn't bind, the animation display normal.