Dynamic Header Of user control - c#

I have develop a user control and i am loading it dynamically through .aspx page.
I have develop an XML and had converted it into hash table for faster searching.
The hash table contains the page name and the respective header.
I am using that hash table to load the header of .aspx page dynamically.
Now, i want that when the user control is called its header is also set dynamically by searching that hash table.
I have tried a lot but the problem which i am facing is that i am not able to trap the requested user control path at runtime.......
pls let me know if u have another solution for this...

If this XML contains HTML that should be displayed as Header, just use the Xml control.

Related

Insert dynamically created HtmlControl into declatatively established asp control

So I guess this is easy for those of you who have been doing this for a while.
I have a master page with 3 content panels. I have a page built on that master page. I have a table that I create in code behind to display the images. The number of images varies do does the size of the table. I need to insert this table into contentPanel2. The table is generated (instantiated) in code behind. How do I do that?
Suprisingly no one answered. Add asp panel to aspx, name it and use add() method of that panel to insert new controls into it.

How to sort dynamically created GridViews in code-behind

I have a dynamic number of Gridviews created based on user-entered data. Each of the Gridviews has its own header row, and I want the user to be able to sort individual GridViews by clicking on a particular column's header. I've been having trouble writing an OnClick_sort method to reference the particular GridView and that data. Also, I want this to be done on Client-side instead of being passed back to the server, so I need to write the Sort method in a JavaScript, correct? Each GridView has a unique ID, generated when adding the GridView to the control.
You can do that by sing Jquery. Refer This...
http://www.aspsnippets.com/Articles/Scrollable-GridView-with-Fixed-Headers-and-Client-Side-Sorting-using-jQuery-in-ASP.Net.aspx
http://www.aspsnippets.com/Articles/Filter-GridView-Records-using-DropDownList-in-HeaderTemplate-Header-Row-in-ASPNet.aspx
You should keep in memory the elements of the grid and sort it using your code (handling events and etc). But, the magic is: you should put your grid in a updatePanel, so your code will be translated to a script that will execute on the cliente side. If your code is too complex to run on the cliente, it will comunicate with the server without your intervension.
Is that? ;)

How to highlight an HTML content and save it to the database as per user for future loads

I'm trying to highlight the selected text contents by the user inside the HTML page.I have highlited the text using jquery (dot net). Now I need to save some information to the database that makes me able to highlight the same contents again for future loads of the same page, taking care of all inner elements that the text could have inside.
i.e.,
Have a base HTML files thats same for every user, given the freedom to user to highlight content in provided page, after he highlites, information needs to saved to database against each user, so that when user open the same html file again,(HTML files shown in a panel) he gets the same page with the highlighing he had done earlier.
Please suggest what information should I save to database..
any pointer how would I move ahead..
Thanks in advance your help.
not a dot net expert , but it seems like you are storing content in database, when fetching they need to be highlighted.
the best way is save content as html or write you own highlight tag
and then replace it to blank when highlight not needed , and replace it with
<div style="background-color:red"> to highlight.
Hope you are getting the approch.
And if you are using HTML files , then it is always better to store them in database. String manuplation for every request will be much heavy task to do.

How to add html saved to a blob directly to page .aspx source

I have a page that I need to allow a user to edit, then I parse the information into HTML and save it to a MS SQL 2008 R2 database. I need to then add this information to an announcements page from the items contained in the database.
I am using C#, so the question is how would I do this? I have a div specifically for the content. Also, is this the best way to allow a user to manage content if I cannot use a cms ( this question is not so vital as I know it is prob more complicated than I realize)?
You can use an asp:Literal control to insert the HTML on the page via the "Text" property on the server-side:
Markup:
<asp:Literal ID="litAnnouncement" runat="server" />
Code-behind:
string htmlAnnouncement = GetHtmlFromDB(); // Get the HTML however you need to as a string.
litAnnouncement.Text = htmlAnnouncement;
I would put the code above somewhere in one of the Load or Init events, either for the page or the Literal control. Of course, there are other ways to do this, but I think this is the most straight-forward given your description.
I didn't get your question completely. but if you want to save data from an HTML element into the SQL data base, then you can add a Sqldatasource control to your page, and then define it with a parameter in the source code.

Control label in other page in asp.net using C#

i want ask about control label or link
i have label in home page
and I want change this label content from admin page
how to control and change it?
you want a sort of content management system, try saving this label in some datasource (xml or database) and then use it where required.
More details would be good. You want to be able to have an admin page where you have an input form that allows you to set content on the home page? If so, there are a few ways to do that. One way is to use a database to store the content, and then load from database on the home page. Another way is to store data in the HttpContext object, this however is not persistent.
You'll want to the display text from some sort of dynamic source, such as a database, xml file, flat file, etc. In the admin page, you write to that data source and load the text for the source from that source as well.

Categories