Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

c# - Find/parse server-side <?abc?>-like tags in html document -


i guess need regex help. want find tags <?abc?> can replace whatever results code ran inside. need regexing tag/code string, not parsing code inside :p.

<b><?abc print 'test' ?></b> result in <b>test</b>

edit: not in general, matching (<?[chars] (code group) ?>)

this build new copy of string source, replacing <?abc code?> result of process(code)

regex abctagregex = new regex(@"\<\?abc(?<code>.*?)\?>");  stringbuilder newsource = new stringbuilder(); int curpos = 0;  foreach (match abctagmatch in abctagregex.matches(source)) {     string code = abctagmatch.groups["code"].value;     string result = process(code);      newsource.append(source.substring(curpos, abctagmatch.index));     newsource.append(result);     curpos = abctagmatch.index + abctagmatch.length; }  newsource.append(source.substring(curpos)); source = newsource.tostring(); 

n.b. i've not been able test code, of functions may wrong name, or there may off-by-one errors.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -