Showing posts with label display. Show all posts
Showing posts with label display. Show all posts

Monday, March 26, 2012

ConfirmButtonExtender display

i have a "ConfirmButtonExtender" and a save button and the save button wire to "ConfirmButtonExtender" and when i click on save button i get the confirmation which is great.

this.ConfirmButtonExtender1.ConfirmText ="Are you sure?";

but the questin i have is:

is there a way to disable the confirmbuttonextender for certain roles?

what i mean is, i have two roles (admin, users) if the user click on save button i want to display "are you sure" and if the admin clicks i dont want to display any confirmation window.

is that possible ?

thanks

i fixed!

ConfirmButtonExtender Change Button Text

I want to display the button text in Spanish, ie "Borrar" and "Cancelar" instead of "Ok" and "Cancel". How do I achieve this?.

Regards

Peeyush

hello

you can't change the alert buttns text ...

its the same as the browse button of file upload ,

the text depends on the language settings on the client browser .


The sample website at

http://www.asp.net/AJAX/AjaxControlToolkit/Samples/Walkthrough/OtherNeatStuff.aspx

says that strings displayed in the browser can be localized.

Can this help?


this can't be used for localizing the text of the alert buttons.

Saturday, March 24, 2012

Confirmation message on modal popup after postback, before it closes

A modalpopup closes immediately after a postback...but is there anyway that I can display a confirmation message on the modalpopup panel before the modalpopup closes?

Hi champ1979,

There are probably a few different ways you could do this. I think the easiest would be to use fake Ok/Cancel buttons and hide the real OK/Cancel buttons (using "display: none"). Then when the fake buttons are clicked, have them display the confirmation and finally call .click() on the real button.

Thanks,
Ted

I'm not quite sure I understand. You mean display the confirmation message before the real button is processed? How would I know if the action was a success or a failure? Or did I miss what you were trying to say?

Also, do I have to do this via JavaScript?

Thanks!


Could you perhaps give a code snippet? It seems like the moment I have a postback, the panel disappears, even if the postback trigger control (the OkButton) is not associated with the modalPopup OkButton attribute. I would like the Panel to stay open until the user manually clicks on a "close" button or icon.


Thanks in advance!


Hi champ1979,

I guess I'm not quite following what you're trying to accomplish here. There's no way to stop aModalPopup from closing after a full postback (because it wasn't actually opened in that postback yet). To work around this, you should wrap any of your controls that have server events inside anUpdatePanel (but theUpdatePanelshould still be inside the popup). I'm also not sure kind of confirmation message we're talking about. Here's some code showing what I think you might have in mind:

<%@. Page Language="C#" %><%@. Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> protected void Other_Click(object sender, EventArgs e) { Other.Style[HtmlTextWriterStyle.Display] = "none"; }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"><title>Test Page</title></head><body><form runat="server"><div> <atlas:ScriptManager ID="ScriptManager" runat="server" EnablePartialRendering="true" /> <asp:LinkButton ID="Open" runat="server" Text="Open" /> <asp:Panel ID="Popup" runat="server" CssClass="modalPopup" style="display:none; border:solid 1px #000000;"> <atlas:UpdatePanel ID="Update" runat="server" Mode="Always"> <ContentTemplate> Popup!<br /> <asp:Button ID="Other" runat="server" Text="Other" OnClick="Other_Click" /><br /> </ContentTemplate> </atlas:UpdatePanel> <asp:Button ID="FakeOk" runat="server" Text="OK" OnClientClick="if (confirm('Close popup?')) { $('Ok').click(); } return false;"></asp:Button> <asp:Button ID="FakeCancel" runat="server" Text="Cancel" OnClientClick="if (confirm('Close popup?')) { $('Cancel').click(); } return false;"></asp:Button> <asp:Button ID="Ok" runat="server" Text="OK" Style="display: none;"></asp:Button> <asp:Button ID="Cancel" runat="server" Text="Cancel" Style="display: none;"></asp:Button> </asp:Panel> <atlasToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server"> <atlasToolkit:ModalPopupProperties TargetControlID="Open" PopupControlID="Popup" OkControlID="Ok" CancelControlID="Cancel" /> </atlasToolkit:ModalPopupExtender></div></form></body></html>

Hopefully this helps. If you have any other questions, just keep posting.

Thanks,
Ted

Thanks for your response and sorry for the confusion. What I really meant by a confirmation message is,after a user presses the OkButton, I want a message to be displayed to the user before the popup closes. Something like "Your comment was posted successfully. The moderator will have to approve it before it appears", or "There was an en error posting your comment. Please try again later".

I guess my terminology was wrong, but I think it should be clearer now.

Please let me know if this sort of thing is possible.

Thanks!


OK, actually the update panel did the job. Thanks :-)

Hi,

I'm glad I could help.

Thanks,
Ted


Ted,

Along these same lines. If I have a radio button list and a drop down list inside an update panel which are all in the Modalpopup, theoretically, I should be able to click a value in the rbl and have it update the ddl's values, without it hiding my modal popup? I am unable to get that to work so far.

Thanks,

Shep


Ted Glaza [MSFT]:

Hi champ1979,

I guess I'm not quite following what you're trying to accomplish here. There's no way to stop aModalPopup from closing after a full postback (because it wasn't actually opened in that postback yet). To work around this, you should wrap any of your controls that have server events inside anUpdatePanel (but theUpdatePanelshould still be inside the popup).

This suggestion is exactly what I was looking for, Ted, the only problem is that I am having some trouble implementing it. I was hoping maybe you or another member might be able to help. I have a modalpopup with two list boxes and two buttons: add and remove. The add button should move the selections from listbox #1 to listbox #2 and the remove button obviously does the opposite. I have two server side events wired up to the buttons. All of this is wrapped up in an UpdatePanel, which is inside a regular Panel that is extended by a ModalPopup control. The problem is that clicking one of the buttons nevertheless causes the modalpopup to disappear. I would expect that the postback would cause a partial page render just inside the UpdatePanel, but that does not seem to be occurring. Here is the code in question:

1 <asp:Panel ID="EmailRecipientsPopupPanel" runat="server" Width="600px" Height="410px" style="display: none" CssClass="modalPopup">23 <asp:SqlDataSource ID="RecipientsEmailAddressesDataSource" runat="server" ConnectionString='<%$ ConnectionStrings:PollingDBConnectionString%>' SelectCommand="SELECT ea.[EmailAddressId], ea.[EmailAddress] FROM EmailAddresses ea WHERE ea.[EmailAddressId] NOT IN (SELECT r.[EmailAddressId] FROM Recipients r WHERE r.[RecipientsGroupId] = @.Recipients);">4 <SelectParameters>5 <asp:ControlParameter ControlID="EmailRecipients" Name="Recipients" PropertyName="Value" Type="Int32" />6 </SelectParameters>7 </asp:SqlDataSource>8 <asp:SqlDataSource ID="EmailRecipientsDataSource" runat="server" ConnectionString='<%$ ConnectionStrings:PollingDBConnectionString%>' SelectCommand="SELECT ea.[EmailAddressId], ea.[EmailAddress] FROM Recipients r JOIN EmailAddresses ea ON r.[EmailAddressId] = ea.[EmailAddressId] WHERE r.[RecipientsGroupId] = @.Recipients;">9 <SelectParameters>10 <asp:ControlParameter ControlID="EmailRecipients" Name="Recipients" PropertyName="Value" Type="Int32" />11 </SelectParameters>12 </asp:SqlDataSource>13 <asp:Label ID="EmailRecipientsPopupPanelLabel" runat="server" CssClass="popupWindowLabel">Edit email recipients<br /><br /></asp:Label>14 <asp:UpdatePanel ID="EmailRecipientsUpdatePanel" runat="server">1516 <ContentTemplate>1718 <table border="0" width="100%" align="center">1920 <thead>2122 <tr>2324 <th align="center">Email Addresses</th>25 <th></th>26 <th align="center">Email Recipients</th>2728 </tr>2930 </thead>31 <tbody>3233 <tr>3435 <td align="right"><asp:ListBox ID="RecipientsEmailAddressesListBox" runat="server" SelectionMode="Multiple" DataSourceID="RecipientsEmailAddressesDataSource" DataTextField="EmailAddress" DataValueField="EmailAddressId" Rows="20" Width="100%" /></td>36 <td align="center" valign="middle"><asp:Button ID="AddRecipientsButton" runat="server" Text=">>" OnClick="AddRecipientsButton_Click" /><br /><br /><asp:Button ID="RemoveRecipientsButton" runat="server" Text="<<" OnClick="RemoveRecipientsButton_Click" /></td>37 <td align="left"><asp:ListBox ID="EmailRecipientsListBox" runat="server" SelectionMode="Multiple" DataSourceID="EmailRecipientsDataSource" DataTextField="EmailAddress" DataValueField="EmailAddressId" Rows="20" Width="100%" /></td>3839 </tr>4041 </tbody>4243 </table>4445 </ContentTemplate>4647 </asp:UpdatePanel>48 <asp:Button ID="EmailRecipientsOk" runat="server" Text="OK" OnClick="EmailRecipientsOk_Click" /> <asp:Button ID="EmailRecipientsCancel" runat="server" Text="Cancel" OnClick="EmailRecipientsCancel_Click" />4950 </asp:Panel>51 <ajax:ModalPopupExtender ID="EmailRecipientsPopup" runat="server" TargetControlID="EmailRecipientsPopupLink" PopupControlID="EmailRecipientsPopupPanel" BackgroundCssClass="modalBackground" />
I'm hoping I'm just doing something wrong and I can actually get this to work the way I want.


I was just thinking about something. Could the fact that I have this UpdatePanel nested in another one have something to do with it? If I had to guess I would imagine that nesting an UpdatePanel in another UpdatePanel probably doesn't "hide" the nested UpdatePanel's child controls from the parent UpdatePanel's. Do I need to disable ChildControlsAsTriggers and manually add all of the controls that should cause postbacks?
Okay, nevermind. I mistakenly thought that the UpdateMode is Conditional by default. It looks like it is "Always." I changed the UpdateMode of the parent UpdatePanel to Conditional and everything worked as expected.

Ok that has been driving me crazy for the last few days. Thanks MetalJon, that solved my issue. I have several update panels within each other and setting Conditional in the parent and parent/parent update panel did the trick.

Condition Animation Slow

Here is the code. I also had OnMouseOver event that had a condition ofdocument.getElementById('SreryBio').style.display!='block'" then change pic. This was also slow I had to keep the ouse over target for a while til the pic changed.
 
Any ideas how to make this faster?
 
 
1<Condition ConditionScript="document.getElementById('SreryBio').style.display=='block'">2 <Parallel AnimationTarget="SreryBio" Duration=".5" Fps="30">3 <Scale ScaleFactor="0.05" Center="true" ScaleFont="true" FontUnit="px" />4 <FadeOut />5 <ScriptAction Script="document.getElementById('ctl00_Side_SreryLink').src='Images/BSCI_-team_srery.jpg';" />6 </Parallel>78 <Condition ConditionScript="document.getElementById('RoderickBio').style.display=='block'">9 <Parallel AnimationTarget="RoderickBio" Duration=".5" Fps="30">10 <Scale ScaleFactor="0.05" Center="true" ScaleFont="true" FontUnit="px" />11 <FadeOut />12 <ScriptAction Script="document.getElementById('ctl00_Side_RoderickLink').src='Images/BSCI_-team_roderick.jpg';" />13 </Parallel>1415 <Condition ConditionScript="document.getElementById('HarrisonBio').style.display=='block'">16 <Parallel AnimationTarget="HarrisonBio" Duration=".5" Fps="30">17 <Scale ScaleFactor="0.05" Center="true" ScaleFont="true" FontUnit="px" />18 <FadeOut />19 <ScriptAction Script="document.getElementById('ctl00_Side_HarrisonLink').src='Images/BSCI_-team_harrison.jpg';" />20 </Parallel>21 <Condition ConditionScript="document.getElementById('YeakelBio').style.display=='block'">22 <Parallel AnimationTarget="YeakelBio" Duration=".5" Fps="30">23 <Scale ScaleFactor="0.05" Center="true" ScaleFont="true" FontUnit="px" />24 <FadeOut />25 <ScriptAction Script="document.getElementById('ctl00_Side_YeakelLink').src='Images/BSCI_-team_yeakel.jpg';" />26 </Parallel>27 <Condition ConditionScript="document.getElementById('MaldoBio').style.display=='block'">28 <Parallel AnimationTarget="MaldoBio" Duration=".5" Fps="30">29 <Scale ScaleFactor="0.05" Center="true" ScaleFont="true" FontUnit="px" />30 <FadeOut />31 <ScriptAction Script="document.getElementById('ctl00_Side_MaldoLink').src='Images/BSCI_-team_maldonado.jpg';" />32 </Parallel>33 <Condition ConditionScript="document.getElementById('YatoomaBio').style.display=='block'">34 <Parallel AnimationTarget="YatoomaBio" Duration=".5" Fps="30">35 <Scale ScaleFactor="0.05" Center="true" ScaleFont="true" FontUnit="px" />36 <FadeOut />37 <ScriptAction Script="document.getElementById('ctl00_Side_YatoomaLink').src='Images/BSCI_-team_yatooma.jpg';" />38 </Parallel>39 <Condition ConditionScript="document.getElementById('RayBio').style.display=='block'">40 <Parallel AnimationTarget="RayBio" Duration=".5" Fps="30">41 <Scale ScaleFactor="0.05" Center="true" ScaleFont="true" FontUnit="px" />42 <FadeOut />43 <ScriptAction Script="document.getElementById('ctl00_Side_RayLink').src='Images/BSCI_-team_ray.jpg';" />44 </Parallel>4546 </Condition>47 </Condition>48 </Condition>49 </Condition>50 </Condition>51 </Condition>52 </Condition>
Hi boricua,

The animation framework wasn't designed to include that much logic. Keep in mind that all that script is dynamically evaled every time the mouse hovers over your element (which is terribly inefficient as it doesn't change, etc.). You should really pull all of that out into regular JavaScript that creates/plays an animation when one of those conditions is satisfied. It looks like the animation is the same for all of them too, so you have the potential to make this really fast/smooth.

Thanks,
Ted

Wednesday, March 21, 2012

comparision with old data

Hi,

I am trying to have a display data in a table inside a update pannel. Basic idea is to get refreshed data and display for user. So far so good. But i want to heighlight the data that is changed since all data may not change everytime though its fetched everytime. How do i chk if data is changed or not ? since each time what i have is only updated value from database. I tried storing data in simple hidden input field dynamically, but as its refreshing only part of page, its not posted, and i could not access it. Does anybody know a way to do this in better way ?

Thanks :)

This is just a thought and I dont know if it will work or not, but maybe use two Datasets, one dataset for the currently displayed data and the other dataset for the new/pending to display data. Itterate though both in a loop, compare the values in the same index postion and if they are different, make your style changes, otherwise, make no style changes. As you itterate though the loop, copy the value from the new/pending dataset to the current dataset. Your new/pending dataset becomes the old one. Although, I think this might need more thought than what I simply typed here.

You may want to go with a similar approach still using the current dataset and the new/pending dataset but create an array that contains the data with its style that you are going to display. You still do the comparison as I mentioned above, but instead of changing the dataset, you change the values in the array. After the comparsion is complete, you render the table based on what is in the array. You then close the old data set or make its data source be that of the new/pending data source.

Another option, instead of using the array is to build the table dynmaically and storing the the values in there as apposed to the array. You have to store the values somewhere so why not store them in the object that you plan to render anyways. This I am assuming you are creating your tables like this: Table tbl = new Table TableRow tr= new TableRow

I wanted to give you a few options but I think the last one is your best one. With the last option you may not even need two datasets, you only need your new/pending one and you always compare it with what is in the value of your TableCell. This will only work if you are using Table Controls as apposed to creating yoru tables like so: string strTable += "<td>" + strSomeValue + "</td>";

If you need further help on the thrid option (Using a table control with one dataset) let me know. I think this is the best way to go.

Good luck!


Thanks really for that quick reply. I would like to try on the array meathod, since in this application i'm anyway gonna strain the db by calling refreshed entries every 3 seconds, from 100s of users at a time. So i guess array will be managible. But can u help me a bit further as to how i create an array that has dynamic number of elements, since for every user it'll be different no of elements, depending on wht he has opted for.


shiloo75:

I tried storing data in simple hidden input field dynamically, but as its refreshing only part of page, its not posted, and i could not access it.

The hidden input value is posted even when it is outside of your updatepanel!

You can get the value of the hidden field this way:

Page.Request.Form.Get( "your field's id" )