Add control to Asp page and position in C# - c#

I have a varying number of links that I need to add to a webpage using C#. A little background may help so, the ultimate goal of this is to have the user select an area of a map and choose the data they would like to get from this map. After the data reports have been generated, a link pops up for each area selected that is a download link for the report.
I can add new links fine, but I'd like to keep things centered on the page like the main control, but when I add a new hyperlink it keeps adding it to the left side. I have my page style set to centered and I don't see the option in a hyperlink object to set it's position. Is there any other way I can do this?
Forgive me but it's my first C# web app.
Thanks!

Make yourself a
<asp:PlaceHolder runat="server" id="plhFoo" />
In the location that you want to add your dynamic stuff to, and then add your controls to this, instead of the page.
-- Edit
If you want to position it, you may put a
<asp:Panel runat="server" ID="pnlFoo" CssClass="someclass" />
And style someclass; because the panel will render as a div.

Related

Using multiple placeholders on a page?

Currently on my website when a user logs in if their role in their row within the Users table is equal to 0 it will give the user 3 options on options.aspx, however if not it will take them to home.aspx
Now I am trying to just do this on one whole page, so if the user was to be directed to the options page, instead it would take them to the home page where the user would have to click an option amongst the 3, if the user has already selected an option then it would load a different content placeholder.
Is a content placeholder what I need to achieve my idea? If so, wouldn't it be abit too easy to get out of the situation since the client could inspect element and edit the visibility on their side?
When you set the Visible="false" property on a server-side control (runat="server") the tag is NOT rendered to the browser. As a result, the client cannot set it as visible. So for example:
<asp:PlaceHolder runat="server" Visible="false">SomeText</asp:PlaceHolder>
The SomeText will be nowhere to be found in the HTML if the user does View Source. If, however, you do a CSS style on a control such as style="display:none" then your concern is 100% valid as the user could just show this.
This same logic hold true for any ASP.NET server-side control. If you set Visible="false" it's never sent to the browser.

How to add a page heading in front of your page numbers in GridView

I'm looking to add a page heading in front of the page numbers in GridView. I have highlighted what I am trying to achieve with the picture below with the arrow.
As Sami mentioned in the comments above, GridView's PagerTemplate should allow you to do this easily. Here's a tutorial on how to implement a PagerTemplate:
http://www.aspnettutorials.com/tutorials/controls/gvpagertemplate-csharp/
Please note that in the tutorial they're also showing how to add a dropdown to select the page. This is more complicated that what you're trying to do, but, if you notice, they're also modifying the text in front of the page listing. Look for code similar to the following:
<asp:label id="labelPagerMessage" text="Page:" runat="server"/>

Display web form in tooltip

I have used calendar control of ASP.NET. When I move on any date than it will be display tooltip , in which I can show my another aspx page. And in that aspx page there is gridview.
How can I display tooltip which contains aspx page.
Try this
Track one
Use a div to position your element as a tooltip.
In that div use an iframe in which you can load your aspx page.
Track two
you can use div without iframe and use jquery to pull data from server against hovered date and render that data into that div at runtime using $("#divID").html() function.
Personally I would recommend track two because here page life cycle is eliminated and data would load much faster which is required for a tooltip,
only demerit with track two is that its a little complicated because you will have to create your design at runtime using document.createElement() and other functions like that.
You could get some help from Here maybe.

Add onmouseover event in links rendered in C#.net webbrowser control

My task is to highlight selected words rendered in html in webbrowser control of C#.net. I accomplish it by using IHtmldocument2. (ref: http://www.codewrecks.com/blog/index.php/2009/02/13/highlight-words-in-webbrowser-control/).
Now, my next task is when i mouseover on the highlighted text, a custom popup will appear to show some information about that highlighted text. It serves like a tooltip. How can i do this? can you give me some sample codes?
Help Please
Thanks
I suggest jQuery here are some tutorials for popups http://speckyboy.com/2009/09/16/25-useful-jquery-tooltip-plugins-and-tutorials/. In the control/function that highlight the words you should be able to set the attributes needed for jQuery to show popups.
what i did with this is just create a div and insert it in the body section. i created a javascript that sets the position property of that div to absolute and with just simple coordinates, i set the top and left property of the div to the position of the element being hover on.

Using Ajax method (how to do it)

Using an update panel in ASP.NET and with the help of a good tutorial on ListView from Matt Berseth I accomplished the image below.
alt text http://www.balexandre.com/temp/StackOverflow_HowToStartUsingAJAX.png
The behavior is, when I click the BOLD names, the rows below that name with numbers are collapsed.
Getting the DATA:
This is a SDK WebService that I cannot change, and with it I get the bold names in one call and for each bold name the list of the numerable rows, in this example I had to call 4 times the Web Service
1 call to provide me with all bold names and then 1 call per bold name to get the secondary list.
My employer told me to not do this, but only get the secondary row when a user clicks in the bold name ...
What should I do now? I'm kind'a lost here. :(
I know "what to do" but not "how to do"
I created a new row in the HTML to be replaced using jQuery
in the listView_ItemDataBound method I change the javascript to have that Row ID in order to be easier to use the javascript function
But, how do I show a "loading" image in that particular Row and load the secondary list?
(I already have a big one that is used to show a wait message when retrieving the bold names list)
alt text http://www.balexandre.com/temp/SuperOffice_forum_loadingIndicator.png
Do I need to create a middle WebService of my own to request this data right?
BIG problem is that I need to check "On Submit" those checkboxes in the secondary rows as well :(
I'm completely lost here, can anyone show me the light please?
ASP.NET Ajax can can use UpdateProgress the to display an image or anything.
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="updPanel1" DisplayAfter="0">
<ProgressTemplate>
<img alt="Please Wait" src="Images/processing.gif" />
</ProgressTemplate>
</asp:UpdateProgress>
You can use javascript to move it to any area on a page by setting the position to absolute.
The best way to do this solution is to program the who page using post backs. Then put an Ajax UpdatePanel on the page.
The web services you can call on the click event on each of the row to populate the data. Put the data in a panel that is hidden. Use Jquery and a start up script to display it if want it to "slide" down.
The best advice I can give is don't worry yet about having a real slick UI. Get the page working, and get the data from the web service. Then after you have that done, work on getting the UI to look better.
This is like playing music, you can't write all the parts of a song at once. You start with a theme then you create the melody, the second and 3rd parts etc. . . .

Categories

Resources