Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google      Sign In   
  • Create Account

Subscribe to HRA Now!


Are you a Google Analytics enthusiast?

Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE! 




From the folks who brought you High Rankings!

- - - - -

C# Non Seo Question...

  • Please log in to reply
2 replies to this topic

#1 scouseflip


    HR 4

  • Active Members
  • PipPipPipPip
  • 205 posts
  • Location:North West, England

Posted 23 March 2012 - 07:28 AM

Hi all, not an seo question but hoping someone with c# knowledge can help me!

I'm building a back end for a website that will let the owner (a joiner) control the previous jobs he wants to showcase on his site. Pretty simple mostly but one issue is stumping me at the moment....

I have a page where he can tweak the details of each job, including the order in which the various images of that job are displayed. At the moment it relies on him uploading each image in the order it should be displayed which is pretty poor usability!

So I have added a [sort] field to the database entry for each job picture - when he goes to the editting page for any given job, it returns all the images he has uploaded and dynamically writes a html textbox against each image - this is where I want him to be able to enter the sort priority for that image.

Where I am struggling is on how to proceed when he hits the update button to trigger the related function in the c# code page...

I have given all of these textboxes the same name - picSort - and have dynamically set the ID to the pictures id in the database. So what I have to work with so far is something that looks like this:

<img src="../images/jobsS/JOBPIC_163201260206PM.jpg" alt="" />
<br />Sort: <input style="width:50px" type="text" name="picSort" id="13" />

<img src="../images/jobsS/JOBPIC_163201260437PM.jpg" alt="" />
<br />Sort: <input style="width:50px" type="text" name="picSort" id="15" />

<img src="../images/jobsS/JOBPIC_163201260531PM.jpg" alt="" />
<br />Sort: <input style="width:50px" type="text" name="picSort" id="16" />

<img src="../images/jobsS/JOBPIC_163201260627PM.jpg" alt="" />
<br />Sort: <input style="width:50px" type="text" name="picSort" id="17" />

<img src="../images/jobsS/JOBPIC_163201260700PM.jpg" alt="" />
<br />Sort: <input style="width:50px" type="text" name="picSort" id="18" />

Essentially what I need to do is:
  • Find all html texbox controls in the form with the name "picSort"
  • For each of these I need to update the database entry with the id in the ID field, with the sort value that has been entered in the textbox
I have not done much work with dynamically created html controls before as I have opted in the past to dynamically write a link to a page that does the work, with parameters carrying any relevant variables through... Any ideas or a point in the right direction would be appreciated!



#2 chrishirst


    A not so moderate moderator.

  • Moderator
  • 7,718 posts
  • Location:Blackpool UK

Posted 23 March 2012 - 09:15 AM

Order them in the database query instead of messing about with C#

SELECT fieldlist FROM .... .... ORDER BY sortcolumn;

#3 scouseflip


    HR 4

  • Active Members
  • PipPipPipPip
  • 205 posts
  • Location:North West, England

Posted 27 March 2012 - 04:23 AM

Thanks for the reply and sorry for not responding until now.

The problem I am having is setting the value of the sort column not displaying based on the sort column... I produce a list of images from the database display them in a list (DataRepeater) with a textbox for each - the value for the sort order should be entered in these textboxes by the user and when they click to update, it should write these values back to the db with the relevent sort value against the relevant db entry.

But I don't know how to access the values and tie each to the corresponding image...

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

We are now a read-only forum.
No new posts or registrations allowed.