|
|
Currently we r using Anthem for Ajax any ref for the same.
Thanx,
Mini
|
|
|
|
|
hi there,
I've found many ways of parsing an html file inside an aspx page and they all work good with plain html controls but none of them are able to render a full featured server control.
I was thinking of loading the html file from disk and inserting its contents inside the of my aspx, so far so good but I needed to replace my custom tags on this html file with some function to render the server controls.
---------------------------------------------------------------
SAMPLE HTML:
@@pageheader@@ | @@calendar@@ | @@main@@ | | |
---------------------------------------------------------------
ASPX FILE:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="02.aspx.cs" Inherits="_02" %>
<title>template 2
<%
//LOAD HTML FROM FILE;
//SEARCH FOR MY PRE-DEFINED TAGS
//REPLACE THOSE FOUND TAGS WITH PARSEABLE FUNCTIONS
...eg: the @@calendar@@ custom tag would replaced
with a renderCalendar() function that would render a calendar
when parsed by asp.net
%>
---------------------------------------------------------------
CODEBEHIND:
public void renderCalendar()
{
...
this.Controls.add(aNewCalendar);
}
---------------------------------------------------------------
this approach doesnt work and gives me a :
"Collection was modified; enumeration operation may not execute."
Asp.net will process the page and on the place where the custom
Tags were replaced with my functions (like the calendar) it would
Run that function that adds the control to the collection,
But it control should be added at that specified position on the
Html file. The html should be read by asp.net as it was an
Original aspx code in order to be rendered at the correct place;
Is that possible to achieve?
do you guys have any tip for me?
thanks a lot
-- modified at 13:38 Sunday 8th October, 2006
|
|
|
|
|
I assume that you know how to load the file...
Use a regular expression to locate the tags:
string[] tags = RegEx.Split(htmlCode, "@@(.+?)@@");
Now you have an array with altering html code and predefined tag names, i.e. the first element contains the html code up to the first predefined tag, the second element contains "pageheader", and so on. You can loop through the array and create LiteralControl elements to put the html code in, and elements according to the predefined tag names.
Don't put code in the aspx page to output the elements, though. Put a PlaceHolder in the page, and add elements to it's Controls collection from code behind.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa,
that sounds very clever but how exactly do I output the controls at the specified position on the html using placeholders? I would need to put one placeholder for each @@tag@@ on the place the @@tag@@ is and then add the controls to that placeholder, but how to insert placeholders there if the collection cannot be modified at runtime?
thanks a lot man
|
|
|
|
|
No, don't try to insert the elements in the html code, split up the string and add the html code as plain text and the controls in between.
Simple example:
DaPlaceHolder.Controls.Add(new LiteralContrl("<div>"));<br />
DaPlaceHolder.Controls.Add(someControl);<br />
DaPlaceHolder.Controls.Add(new LiteralContrl("</div><div>"));<br />
DaPlaceHolder.Controls.Add(otherControl);<br />
DaPlaceHolder.Controls.Add(new LiteralContrl("</div>"));
---
b { font-weight: normal; }
|
|
|
|
|
I'm "trying to try it" here but can't get this to compile:
string[] tags = RegEx.Split(htmlCode, "@@(.+?)@@");
ERROR=The name 'RegEx' does not exist in the current context
my includes:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using System.Text.RegularExpressions;
I have no experience at all with regular expressions..
would you mind making a sample file for me please?
|
|
|
|
|
whoops, just learned something, its Regex, not RegEx...
|
|
|
|
|
alright, I finnally got that part working, I really appreciate your help.
Since I don't know nothing about regex I would like to make complementar question:
If I design the html using an editor I will have the whole html structure when I read the file,
I was thinking of how can I parse the , and tags from the html so I could strip their contents and print them out on the correct place on my aspx, it would be so much easier than cutting down the design html parts everytime I change it and to hardcode additional css or js on the header, for example the following design:
------------------------------------------------
<script....!
<link...!
<head="">
<script>....!
<form>
<table...!
...!
<table...!
<form>
<div...!
<body>
------------------------------------------------
if I could just parse those main elements and get the contents inside them (ending with "!") printing those lines my aspx file... do you think it is possible?
an idea (ASPX):
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>template 2</title>
<% loadCustomHtmlHeaderContents() %>
</head>
<body>
<% loadCustomHtmlBodyUpperContents() %>
<form id="form1" runat="server">
<asp:PlaceHolder ID="TemplatePlaceHolder" runat="server"></asp:PlaceHolder>
</form>
<% loadCustomHtmlBodyLowerContents() %>
</body>
the html file <form> tag would just be ignored since I already have one on my aspx file, I would need it just to reference whats between the <body> and <form> and between </form> and </body>.
===Updated===
or even better , if I add a placeholder to each one of those sections (header,upperbody,lowerbody) it would be much easier to add content there, I just would need a regex to know when I am inside a placeholder like this:
@@header@@
@@/header@@
or
@@upperbody@@
@@/upperbody@@
can you help me parsing that?
at last, I intend to use this on a masterpage and I have just one contentplaceholder there, I was able to clone that control adding it to the placeholder and it shows fine the contents from the other pages but the viewstate is lost... I tried to move the contentplace holder but I think that's not possible, the parent property is locked, is that possible? to put the contentplacholder on the place that I want(move)?
I tried:
//
TemplatePlaceHolder.Controls.Add(MasterPageContentPlaceHolder);
//
the contentplaceholder renders fine but if I use a grid for example and select a row I get:
"System.NullReferenceException: Object reference not set to an instance of an object."
when accessing "GridView1.SelectedValue.ToString()"
it looks like the viewstate is gone after the postback, is that it?
thank you so much again
-- modified at 21:25 Sunday 8th October, 2006
|
|
|
|
|
I have a web site inside my organization that shows the performance of the work load, the site has different security levels according to the user that loggs the site (the security is left to b handled by "windows"),so i want to know the active directory loginame for the user that uses the site in order to load security of the site.
I tried to get the IP of the user request using Request.ServerVariables and using this IP i get the name of the user, but in the server i get invaild names compared to active directory names.
So i need any method that helps me to get the active directory loginame in order to load its security.
Thanks.
marp tech
|
|
|
|
|
Hmmm... I thought I answered this the last time you posted it.
|
|
|
|
|
You don't understand what i want, i don't want to check the user against active directory because i will not provide a login form, i just want to know the login name in the active directory for the user that requsted the page without any inforamtion from the user, i mean that the user will not enter any login name or password, i just want to know if the requrst has came from the network to load the secutity level.
marp tech
|
|
|
|
|
Marp Tech wrote: You don't understand what i want
Well of course I didn't understand what you wanted! I was going by what you wrote, not what you were thinking. The latter is beyond my abilities; I can only go by the former.
Marp Tech wrote: i just want to know the login name in the active directory for the user that requsted the page without any inforamtion from the user
You want to know the login name for the current user, but you don't want that user to log in? Okay. Good luck with that.
Marp Tech wrote: i just want to know if the requrst has came from the network
I don't think there is a reliable way to accomplish this without user tracking. You could grab the IP address of the computer making the request and determine if it is on your network or not - that you could do easily enough. But there are ways to spoof an IP address so I wouldn't call it reliable.
|
|
|
|
|
So how come Windows 2003/SQL Server does not support Active-Active clusters? And is there a maximum number of nodes... even with Active Passive? Is this the reason why SQL Server is "inferior" to Oracle?
Educate me.
|
|
|
|
|
Hello
i had add the edit column to the datagrid and the type of the column is link lable
I WANTto call the update LINK when i press Enter on the TextBox
Mohamad A. Flefel
C#.net Developer
|
|
|
|
|
Hello,
I am trying to convert an Asp.Net 2.0 XML sitemap file to a Google's sitemap file.
I am posting the formats of both files.
1. How can I do the conversion?
2. And can I use an .ashx Asp.Net file that when the .ashx file is called the Google XML file is generated?
Thank You,
Miguel
GOOGLE SiteMap
<?xml version="1.0" encoding="UTF-8"?>
< urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
< url>
< loc>http://www.mydomain.com/example.aspx</loc>
< lastmod>2005-01-01</lastmod>
< changefreq>daily</changefreq>
< priority>0.8</priority>
</url>
</urlset>
ASP.NET 2.0 Site Map
<?xml version="1.0" encoding="utf-8" ?>
<siteMap
xmlns = "http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode>
<siteMapNode
url = "~/example.aspx"
changefreq = "daily"
lastmod = "2005-01-01"
description = "My example page and its contents"
priority = "0.8"
title = "Example page" />
</siteMapNode>
</siteMap>
Note: description and title should be droped when converting from Asp.Net to Google sitemap.
|
|
|
|
|
|
how can i enable debugging in web service?
my client cannot access the service if i create it in the wwwroot\folder\service... however it can access it wwwroot\service like this can i get a logical reason for this
Bu
|
|
|
|
|
i think your problem is that your debugging account has no access rights to subfolders. in the iis snap-in make sure that anonymous access is granted and the account is IUSR_[machinename].after that check event-log if ASPNET user has any problems.
|
|
|
|
|
from where i can set all this??
|
|
|
|
|
what is the Diff between sqlConnection and oleDbconnection?
Which is better and why?
Mini
|
|
|
|
|
If you are going to a sql database, use SQL. Otherwise for Access and Oracle, use OLEDB. The SQL one does not have to go through OLEDB and can talk directly to SQL so it's faster (one less middle man).
|
|
|
|
|
|
i have a templete column with chechbox in datagrid. i want when i checked the checkbox with push the button i can delete that row. how u can help me?
|
|
|
|
|