Saturday, March 31, 2012
Trimming Text for a certian charachter or word
For Example:
www.mysite.com/images/1/4/778814.jpg
www.mysite.com/images/"T"/"U"IDNUMBer.jpg
As you will see the "T" folder comes from the tens spont of the id number. The "U" folder come from the units spot and the image name is the ID and then I have to add jpg. Now i would never create a database like this but that is what this company is supplying me. My question is how to make asp split the id number up to use in other locations.
Thanks
RustyI can think of 2 options. See which is best for you based on the datatype of the idnumber.
a) You can work with strings and use
Dim unit, tens as String
unit = idnumber.ToString().Chars(idnumber.ToString().Length -1) 'to get units character
tens = idnumber.ToString().Chars(idnumber.ToString().Length -2) 'to get the tens character
b) Work with integers and use mathematical operators Eg:
Dim idnumber As Integer
idnumber = 456789
Dim unit, tens As Integer
unit = idnumber Mod 10 ' Returns 9
tens = (idnumber Mod 100) \ 10 ' Returns 8
Use the Split method to split the string by "/" and then you can use each of the elements of the created Array to grab the numbers.
string fullUrl = "www.mysite.com/images/1/4/778814.jpg";
string[] splitParams = fullUrl.Split('/');
splitParams[0] is "www.mysite.com"
splitParams[1] is "images"
splitParams[2] is "1"
splitParams[3] is "4"
splitParams[4] is "778814.jpg"
HTH
DJ
Thursday, March 22, 2012
trouble with image
I'm a beginner of asp.net:( When I click a
(System.Web.UI.WebControls.)Button on a page,of course,its' click event has
been assigned,the images on this page should be refreshed,right?These
images' imageurl are such as "getpic.aspx?id=xxx".But refresh doesn't
happen,why?
Much thanx.Presumably because the browser has cached the image that was at that
URL previously. If you want to load a different image for each screen
refresh then add a random number, or datestamp to the URL for your
image, that way the browser receives a different URL and will
redownload the image.
"Flinky Wisty Pomm" <Pathogenix@.gmail.com> wrote in message
news:1144079199.958679.87150@.v46g2000cwv.googlegro ups.com...
> Presumably because the browser has cached the image that was at that
> URL previously. If you want to load a different image for each screen
> refresh then add a random number, or datestamp to the URL for your
> image, that way the browser receives a different URL and will
> redownload the image.
For a production environment, where the image may not change much, then I
would recommend removing the auto-generated number so that the cache
displays the image. Otherwise, the client may download more than it needs
too...<shrug
Mythran
Thanx for your advice.My current problem: in the button click event,picture
stored in db is changed. "GetPic.aspx?id=xxx" is used to get pic from
db.What I want is after click,the image on this page should display the new
content(reload from db).But now db has updated successfully,the page is
still here,no change.
"Flinky Wisty Pomm" <Pathogenix@.gmail.com>
??:1144079199.958679.87150@.v46g2000cwv.googleg roups.com...
> Presumably because the browser has cached the image that was at that
> URL previously. If you want to load a different image for each screen
> refresh then add a random number, or datestamp to the URL for your
> image, that way the browser receives a different URL and will
> redownload the image.
"removing the auto-generated number so that the cache displays the image"
Sorry but I have no idea how to remove,thanx.
"Mythran" <kip_potter@.hotmail.comREMOVETRAIL>
??:eeIMsezVGHA.5044@.TK2MSFTNGP09.phx.gbl...
> "Flinky Wisty Pomm" <Pathogenix@.gmail.com> wrote in message
> news:1144079199.958679.87150@.v46g2000cwv.googlegro ups.com...
> > Presumably because the browser has cached the image that was at that
> > URL previously. If you want to load a different image for each screen
> > refresh then add a random number, or datestamp to the URL for your
> > image, that way the browser receives a different URL and will
> > redownload the image.
> For a production environment, where the image may not change much, then I
> would recommend removing the auto-generated number so that the cache
> displays the image. Otherwise, the client may download more than it needs
> too...<shrug>
> Mythran
Much thanx,Flinky Wisty Pomm && Mythran:)
I got it,add a RequiredFieldValidator on the page and bind it to any
control,then nothing bother me:) But who can tell me why?puzzling
"tjer" <tj@.tj.edu.cn> ะด?:#jIoo1xVGHA.5288@.TK2MSFTNGP14.phx.gbl ...
> Hi guys,
> I'm a beginner of asp.net:( When I click a
> (System.Web.UI.WebControls.)Button on a page,of course,its' click event
has
> been assigned,the images on this page should be refreshed,right?These
> images' imageurl are such as "getpic.aspx?id=xxx".But refresh doesn't
> happen,why?
> Much thanx.
Tuesday, March 13, 2012
Troubles with using a user control
This Bar uses Images. Im trying to dynalically assign the relative URL
path as image path. That is, a particular image can have src attribute
as "../../images" or "images/" etc based on a public property of
control, callingDepth. This property is set in control delaration in
aspx page.
Im using src="http://pics.10026.com/?src=<% #fixRelPath("Images/med_upper_left1.gif") %> function
call in the ASPx pages.
The problem is that this function is not at all called all through page
load.
Any Clue on what i'm missing.
Thanks for Help.Expressions surrounded by <% # and %> are evaluated when the control
is DataBound. So you need to call the DataBind on the object, or a
container of that object.
For more info on DataBinding Expressions, see
http://www.dotnetjunkies.com/quicks...atabinding.aspx
Troubles with using a user control
This Bar uses Images. Im trying to dynalically assign the relative URL
path as image path. That is, a particular image can have src attribute
as "../../images" or "images/" etc based on a public property of
control, callingDepth. This property is set in control delaration in
aspx page.
Im using src="http://pics.10026.com/?src=<% #fixRelPath("Images/med_upper_left1.gif") %> function
call in the ASPx pages.
The problem is that this function is not at all called all through page
load.
Any Clue on what i'm missing.
Thanks for Help.Expressions surrounded by <% # and %> are evaluated when the control
is DataBound. So you need to call the DataBind on the object, or a
container of that object.
For more info on DataBinding Expressions, see
http://www.dotnetjunkies.com/quicks...atabinding.aspx