Showing posts with label tag. Show all posts
Showing posts with label tag. Show all posts

Thursday, March 29, 2012

Pass information from XML file to ASPX page

Hello,
I have an XML file, which contains let's say a <A> tag with a "AProp"
property. I want to manipulate this XML file so that the value of the
AProp property can be passed to the code-behind class (let's say
code.aspx.cs) of another ASPX page. How can I accomplish that?
Thanks in advance for help,
uservoidHi evangelous,
Maybe this can help you:
http://www.planet-source-code.com/v...gWId=10

Guillermo G.
----
--
Guillermo Gonzlez Arroyave :: MCP ASP.Net C# :: DCE4
<evangelous@.gmail.com> wrote in message news:1122017876.519551.161420@.g49g20
00cwa.googlegroups.com...
Hello,
I have an XML file, which contains let's say a <A> tag with a "AProp"
property. I want to manipulate this XML file so that the value of the
AProp property can be passed to the code-behind class (let's say
code.aspx.cs) of another ASPX page. How can I accomplish that?
Thanks in advance for help,
uservoid

Pass information from XML file to ASPX page

Hello,

I have an XML file, which contains let's say a <A> tag with a "AProp"
property. I want to manipulate this XML file so that the value of the
AProp property can be passed to the code-behind class (let's say
code.aspx.cs) of another ASPX page. How can I accomplish that?

Thanks in advance for help,
uservoidHi evangelous,

Maybe this can help you:
http://www.planet-source-code.com/v...=3753&lngWId=10

Guillermo G.

------------------------
Guillermo Gonzlez Arroyave :: MCP ASP.Net C# :: DCE4

<evangelous@.gmail.com> wrote in message news:1122017876.519551.161420@.g49g2000cwa.googlegr oups.com...
Hello,

I have an XML file, which contains let's say a <A> tag with a "AProp"
property. I want to manipulate this XML file so that the value of the
AProp property can be passed to the code-behind class (let's say
code.aspx.cs) of another ASPX page. How can I accomplish that?

Thanks in advance for help,
uservoid

Wednesday, March 21, 2012

passing a string to a regex

I'm using a regex and want to find a specific tag, like TABLE

this:

(<)(table)

matches this:

<table
<turkey
<amazon

ie, it match < followed by a t or a or b or l or e (at least that's what I
*think* it is doing ;o)

What's the proper way to write out an actual string for matching? I theory,
this should work:

(t)(a)(b)(l)(e)

THe catch is that I'd like to pass 'table' as a string to this. So I'd like
to avoid having to split up the string as an array and then having to build
it like the above.If your string to match against is table, your expression is just the word
table itself, you may want to add RegexOptions.IgnoreCase

"darrel" <notreal@.hotmail.com> wrote in message
news:OGT84LeZEHA.3512@.TK2MSFTNGP12.phx.gbl...
> I'm using a regex and want to find a specific tag, like TABLE
> this:
> (<)(table)
> matches this:
> <table
> <turkey
> <amazon
> ie, it match < followed by a t or a or b or l or e (at least that's what I
> *think* it is doing ;o)
> What's the proper way to write out an actual string for matching? I
theory,
> this should work:
> (t)(a)(b)(l)(e)
> THe catch is that I'd like to pass 'table' as a string to this. So I'd
like
> to avoid having to split up the string as an array and then having to
build
> it like the above.
> If your string to match against is table, your expression is just the
word
> table itself, you may want to add RegexOptions.IgnoreCase

So...this:

(table)

should only match "table"?

That doesn't seem to be happening for me--but maybe I have another issue
with my expression somewhere else. Good suggestion on the IgnorCase option,
though!

-Darrel

> "darrel" <notreal@.hotmail.com> wrote in message
> news:OGT84LeZEHA.3512@.TK2MSFTNGP12.phx.gbl...
> > I'm using a regex and want to find a specific tag, like TABLE
> > this:
> > (<)(table)
> > matches this:
> > <table
> > <turkey
> > <amazon
> > ie, it match < followed by a t or a or b or l or e (at least that's what
I
> > *think* it is doing ;o)
> > What's the proper way to write out an actual string for matching? I
> theory,
> > this should work:
> > (t)(a)(b)(l)(e)
> > THe catch is that I'd like to pass 'table' as a string to this. So I'd
> like
> > to avoid having to split up the string as an array and then having to
> build
> > it like the above.
You dont need the ( ) , its only a grouping construct, however, it should
still work. Post some code so we can take a look.

"darrel" <notreal@.hotmail.com> wrote in message
news:uV4mJjeZEHA.2444@.tk2msftngp13.phx.gbl...
> > If your string to match against is table, your expression is just the
> word
> > table itself, you may want to add RegexOptions.IgnoreCase
> So...this:
> (table)
> should only match "table"?
> That doesn't seem to be happening for me--but maybe I have another issue
> with my expression somewhere else. Good suggestion on the IgnorCase
option,
> though!
> -Darrel
>
> > "darrel" <notreal@.hotmail.com> wrote in message
> > news:OGT84LeZEHA.3512@.TK2MSFTNGP12.phx.gbl...
> > > I'm using a regex and want to find a specific tag, like TABLE
> > > > this:
> > > > (<)(table)
> > > > matches this:
> > > > <table
> > > <turkey
> > > <amazon
> > > > ie, it match < followed by a t or a or b or l or e (at least that's
what
> I
> > > *think* it is doing ;o)
> > > > What's the proper way to write out an actual string for matching? I
> > theory,
> > > this should work:
> > > > (t)(a)(b)(l)(e)
> > > > THe catch is that I'd like to pass 'table' as a string to this. So I'd
> > like
> > > to avoid having to split up the string as an array and then having to
> > build
> > > it like the above.
> >
Here's what I have:

dim r1 as new regex( _
"(?<anythingPreceding>((.|\n)*))" & _
"(?<theTag>(" & tagToFind & "))" & _
"(?<anything>(.[^>/]*))" & _
"(?<theAttribute>(" & attributeToFind & "))" & _
"(?<theEqualsSign>((\s*)=(\s*)))" & _
"(?<theAttributeValue>(.[^\s/>]*))" & _
"(?<anythingSucceeding>((.|\n)*))" _
, RegexOptions.IgnoreCase)
dim m as Match = r1.Match(textToParse)
dim r2 as New Regex("(" & attributeToFind & ")((\s*)=(\s*))(.[^\s/>]*)")
dim s as String = r2.replace(m.tostring, attributeToFind & "=""" &
newAttributeValue & """")
return s

Note that the second group (theTag) is the one I'm concerned with.

If I past "table" to tagToFind, it will match these:

<table width='50' height='12'>
<turkey width='50' height='12'>
<apple width='50' height='12'
So, I *thought* that it was an OR construct.

However, I now notice that it will also match:

<spaghetti width="100%"
So there's obviously something wrong with by Regex in the bigger sense. Let
me stare at it for a bit and see if I can figure this one out ;o)

-Darrel
I'm pretty sure this is the culprit:
"(?<anythingPreceding>((.|\n)*))" & _
"(?<theTag>(" & tagToFind & "))" & _

Or at least part of the problem. The first line should match 'anything' up
until "<table" (I'm passing table to tagToFind)

So, I think I need to look for anything EXCEPT "<table". Correct?

I can't quite get the syntax down, though:

(.|\n(^<table))*

that doesn't seam to work
I figured out what's going on.

I'm finding a large match and then applying a second ReGex to it.

I need to learn how to use the groups ;o)

-Darrel

passing a string to a regex

I'm using a regex and want to find a specific tag, like TABLE
this:
(< )(table)
matches this:
<table
<turkey
<amazon
ie, it match < followed by a t or a or b or l or e (at least that's what I
*think* it is doing ;o)
What's the proper way to write out an actual string for matching? I theory,
this should work:
(t)(a)(b)(l)(e)
THe catch is that I'd like to pass 'table' as a string to this. So I'd like
to avoid having to split up the string as an array and then having to build
it like the above.If your string to match against is table, your expression is just the word
table itself, you may want to add RegexOptions.IgnoreCase
"darrel" <notreal@.hotmail.com> wrote in message
news:OGT84LeZEHA.3512@.TK2MSFTNGP12.phx.gbl...
> I'm using a regex and want to find a specific tag, like TABLE
> this:
> (< )(table)
> matches this:
> <table
> <turkey
> <amazon
> ie, it match < followed by a t or a or b or l or e (at least that's what I
> *think* it is doing ;o)
> What's the proper way to write out an actual string for matching? I
theory,
> this should work:
> (t)(a)(b)(l)(e)
> THe catch is that I'd like to pass 'table' as a string to this. So I'd
like
> to avoid having to split up the string as an array and then having to
build
> it like the above.
>
> If your string to match against is table, your expression is just the
word
> table itself, you may want to add RegexOptions.IgnoreCase
So...this:
(table)
should only match "table"?
That doesn't seem to be happening for me--but maybe I have another issue
with my expression somewhere else. Good suggestion on the IgnorCase option,
though!
-Darrel

> "darrel" <notreal@.hotmail.com> wrote in message
> news:OGT84LeZEHA.3512@.TK2MSFTNGP12.phx.gbl...
I
> theory,
> like
> build
>
You dont need the ( ) , its only a grouping construct, however, it should
still work. Post some code so we can take a look.
"darrel" <notreal@.hotmail.com> wrote in message
news:uV4mJjeZEHA.2444@.tk2msftngp13.phx.gbl...
> word
> So...this:
> (table)
> should only match "table"?
> That doesn't seem to be happening for me--but maybe I have another issue
> with my expression somewhere else. Good suggestion on the IgnorCase
option,
> though!
> -Darrel
>
what
> I
>
Here's what I have:
dim r1 as new regex( _
"(?<anythingPreceding>((.|\n)*))" & _
"(?<theTag>(" & tagToFind & "))" & _
"(?<anything>(.[^>/]*))" & _
"(?<theAttribute>(" & attributeToFind & "))" & _
"(?<theEqualsSign>((\s*)=(\s*)))" & _
"(?<theAttributeValue>(.[^\s/>]*))" & _
"(?<anythingSucceeding>((.|\n)*))" _
, RegexOptions.IgnoreCase)
dim m as Match = r1.Match(textToParse)
dim r2 as New Regex("(" & attributeToFind & ")((\s*)=(\s*))(.[^\s/>]*)")
dim s as String = r2.replace(m.tostring, attributeToFind & "=""" &
newAttributeValue & """")
return s
Note that the second group (theTag) is the one I'm concerned with.
If I past "table" to tagToFind, it will match these:
<table width='50' height='12'>
<turkey width='50' height='12'>
<apple width='50' height='12'>
So, I *thought* that it was an OR construct.
However, I now notice that it will also match:
<spaghetti width="100%" >
So there's obviously something wrong with by Regex in the bigger sense. Let
me stare at it for a bit and see if I can figure this one out ;o)
-Darrel
I'm pretty sure this is the culprit:
"(?<anythingPreceding>((.|\n)*))" & _
"(?<theTag>(" & tagToFind & "))" & _
Or at least part of the problem. The first line should match 'anything' up
until "<table" (I'm passing table to tagToFind)
So, I think I need to look for anything EXCEPT "<table". Correct?
I can't quite get the syntax down, though:
(.|\n(^<table))*
that doesn't seam to work
I figured out what's going on.
I'm finding a large match and then applying a second ReGex to it.
I need to learn how to use the groups ;o)
-Darrel

Friday, March 16, 2012

Passing a variable into a event handler.

I need to pass a variable into an event handler. Unfortuantely the tag i'm using (dataGrid) doesn't support CommandArgument. Any other suggestions how i can pass a variable into an event handler?

I have a datagrid in a repeater, and i populate it with a dataTable, which is retrieved with a StationId that completes the SQL query. Now, when i try to page the dgrd i have to pass that stationId into the paging function.

Since the paging funtion is an eventHandler, it has (object sender, DataGridPageChangedEventArgs e) and so i can't pass any other variables into it

any ideas?Hi,
the DataGridPagechangedEventArgs an be used to get the id of the daatgrid,

can u please check this !!!

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIWebControlsDataGridPageChangedEventArgsClassTopic.asp

in that article u an find code which u can use and make use of to understand your situation !!

Passing a variable to HTML

Hi,

I'm creating a control that displays the Previous and Next Pages. I get the
values I want but they don't display in the HTML Href tag. It just displays
blank. I declared the 2 variables PageBack and PageNext outside the sub but
that doesn't seem to work.
I tried using a session variable but I had to reload the page twice to get
the correct number.

<%@dotnet.itags.org. Control Language="VB" %>
<script runat="server">
Dim PageBack as String
Dim PageNext as String

Sub Page_Load(sender As Object, e As EventArgs)
Dim strPageName = System.IO.Path.GetFileName(Request.Path)
Dim PageName as String = strPageName
Dim PageNumber As String = Mid(PageName,5,3)
Dim BackPg as String = PageNumber - 1
Dim NextPg as String = PageNumber + 1
PageBack= Left(PageName,4)&"00"&BackPg &".aspx"
PageNext= Left(PageName,4)&"00"&NextPg &".aspx"
End Sub

</script>
<a href="http://links.10026.com/?link=<%# PageBack %>">Back</a><br>
<a href="http://links.10026.com/?link=<%# PageNext %>">Next</a
Thanks

--
Message posted via http://www.dotnetmonster.com<a href="http://links.10026.com/?link='<%# PageBack %>'">Back</a><br
Thanks. That still gives me an empty Href. I'm doing a response.write to
make sure there's a value in the variable and there is.

--
Message posted via http://www.dotnetmonster.com

Passing a variable to HTML

Hi,
I'm creating a control that displays the Previous and Next Pages. I get the
values I want but they don't display in the HTML Href tag. It just displays
blank. I declared the 2 variables PageBack and PageNext outside the sub but
that doesn't seem to work.
I tried using a session variable but I had to reload the page twice to get
the correct number.
<%@dotnet.itags.org. Control Language="VB" %>
<script runat="server">
Dim PageBack as String
Dim PageNext as String
Sub Page_Load(sender As Object, e As EventArgs)
Dim strPageName = System.IO.Path.GetFileName(Request.Path)
Dim PageName as String = strPageName
Dim PageNumber As String = Mid(PageName,5,3)
Dim BackPg as String = PageNumber - 1
Dim NextPg as String = PageNumber + 1
PageBack= Left(PageName,4)&"00"&BackPg &".aspx"
PageNext= Left(PageName,4)&"00"&NextPg &".aspx"
End Sub
</script>
<a href="http://links.10026.com/?link=<%# PageBack %>">Back</a><br>
<a href="http://links.10026.com/?link=<%# PageNext %>">Next</a>
Thanks
Message posted via http://www.webservertalk.com<a href="http://links.10026.com/?link='<%# PageBack %>'">Back</a><br>
Thanks. That still gives me an empty Href. I'm doing a response.write to
make sure there's a value in the variable and there is.
Message posted via http://www.webservertalk.com

Passing a variable to HTML tag

Hi,

I'm creating a control to get the next and back page name. When I try to pass that name to the href tag in the HTML, the link is empty and I'm not sure what's wrong. I've checked the values with response.write so I know that the values are there. I've also defined the PageBack and PageNext variables outside the sub.


<%@dotnet.itags.org. Control Language="VB" %>
<script runat="server">
Dim PageBack as String
Dim PageNext as String

Sub Page_Load(sender As Object, e As EventArgs)
Dim strPageName = System.IO.Path.GetFileName(Request.Path)
Dim PageNumStart as Integer = strPageName.Indexof("P") +2
Dim PageNumEnd as Integer = strPageName.Indexof(".")+1
Dim PageNum as String = Mid(strPageName,PageNumStart,PageNumEnd-PageNumStart)
PageBack=Left(strPageName,PageNumStart-1)&PageNum-1 &".aspx"
PageNext=Left(strPageName,PageNumStart-1)&PageNum+1 &".aspx"
End Sub

</script>
Back<br>
Next

I've also tried the href with just the double quotes: ="<%# PageBack %>"
ThanksYou need to call DataBind() at the end of your Page_Load.
Thanks so much. I normally do but forgot it here.