Hi folks,
This seems to have been asked quite a bit but the solutions either dont
pertain to my case or the only response is to supply code. So here's
the question and the code is at the bottom.
I have a datalist which is displaying images in a gallery. Each image
has a pair of buttons to promote or demote the image in the list.
A little explanation about the code. The back end database contains two
tables Image and Gallery. Image contains a path to the image, an unique
ID a foreign key to the Gallery table to determine gallery membership
and an integer sequence number to determine the order it appears within
a gallery.
GalleryQuery is a class with a number of static methods that perform
operation on the backend sql server database. I'll refer to it as GQ in
the following for brevity
GQ.GetMinimumSe quenceNumber gets the lowest sequence number for a given
gallery
GQ.GetMaximumSe quenceNumber gets the highest sequence number for a
given gallery
GQ.GetSequenceN umber gets the sequence number for a specific image
GQ.PromoteImage swaps the sequence number of the chosen image with the
one above.
GQ.DemoteImage swaps the sequence number of the chosen image with the
one below
All of the above works as expected and if I check the backend database
after clicking a promote or demote button the relevent switch has
occured. Reviewing the page shows the switch has occured, however I
can't find a way of making the refresh occur without doing a
response.redire ct or server.transer back to the same page.
Unfortunately there are other controls on the page that lose their
state as a result.
I'm assuming that some thing is required at the points marked // ??? in
the code.
Any help greatly appreciated.
protected void CommandFunction (object source, DataListCommand EventArgs
e) {
int gallery = int.Parse(lstGa llery.SelectedV alue);
int min = GalleryQuery.Ge tMinimumSequenc eNumber(gallery );
int max = GalleryQuery.Ge tMaximumSequenc eNumber(gallery );
int current =
GalleryQuery.Ge tSequenceNumber (int.Parse(e.Co mmandArgument.T oString()),
gallery);
int currentImage = int.Parse(e.Com mandArgument.To String());
if (e.CommandName == "MoveUp") {
if (current min) {
GalleryQuery.Pr omoteImage(curr entImage, gallery);
// ???
}
} else if (e.CommandName == "MoveDown") {
if (current < max) {
GalleryQuery.De moteImage(curre ntImage, gallery);
// ???
}
}
} 2 4296
if you change the database, you need to rebind the datalist
-- bruce (sqlwork.com)
"Simon Rigby" <go****@simonri gby.co.ukwrote in message
news:11******** **************@ m73g2000cwd.goo glegroups.com.. .
Hi folks,
This seems to have been asked quite a bit but the solutions either dont
pertain to my case or the only response is to supply code. So here's
the question and the code is at the bottom.
I have a datalist which is displaying images in a gallery. Each image
has a pair of buttons to promote or demote the image in the list.
A little explanation about the code. The back end database contains two
tables Image and Gallery. Image contains a path to the image, an unique
ID a foreign key to the Gallery table to determine gallery membership
and an integer sequence number to determine the order it appears within
a gallery.
GalleryQuery is a class with a number of static methods that perform
operation on the backend sql server database. I'll refer to it as GQ in
the following for brevity
GQ.GetMinimumSe quenceNumber gets the lowest sequence number for a given
gallery
GQ.GetMaximumSe quenceNumber gets the highest sequence number for a
given gallery
GQ.GetSequenceN umber gets the sequence number for a specific image
GQ.PromoteImage swaps the sequence number of the chosen image with the
one above.
GQ.DemoteImage swaps the sequence number of the chosen image with the
one below
All of the above works as expected and if I check the backend database
after clicking a promote or demote button the relevent switch has
occured. Reviewing the page shows the switch has occured, however I
can't find a way of making the refresh occur without doing a
response.redire ct or server.transer back to the same page.
Unfortunately there are other controls on the page that lose their
state as a result.
I'm assuming that some thing is required at the points marked // ??? in
the code.
Any help greatly appreciated.
protected void CommandFunction (object source, DataListCommand EventArgs
e) {
int gallery = int.Parse(lstGa llery.SelectedV alue);
int min = GalleryQuery.Ge tMinimumSequenc eNumber(gallery );
int max = GalleryQuery.Ge tMaximumSequenc eNumber(gallery );
int current =
GalleryQuery.Ge tSequenceNumber (int.Parse(e.Co mmandArgument.T oString()),
gallery);
int currentImage = int.Parse(e.Com mandArgument.To String());
if (e.CommandName == "MoveUp") {
if (current min) {
GalleryQuery.Pr omoteImage(curr entImage, gallery);
// ???
}
} else if (e.CommandName == "MoveDown") {
if (current < max) {
GalleryQuery.De moteImage(curre ntImage, gallery);
// ???
}
}
}
doh. I cant believe I missed that. Moral of the story is stop trying to
multi task. I should know as a male that doesn't work.
Thanks Bruce (I'll be in the corner)
bruce barker (sqlwork.com) wrote:
if you change the database, you need to rebind the datalist
-- bruce (sqlwork.com)
"Simon Rigby" <go****@simonri gby.co.ukwrote in message
news:11******** **************@ m73g2000cwd.goo glegroups.com.. .
Hi folks,
This seems to have been asked quite a bit but the solutions either dont
pertain to my case or the only response is to supply code. So here's
the question and the code is at the bottom.
I have a datalist which is displaying images in a gallery. Each image
has a pair of buttons to promote or demote the image in the list.
A little explanation about the code. The back end database contains two
tables Image and Gallery. Image contains a path to the image, an unique
ID a foreign key to the Gallery table to determine gallery membership
and an integer sequence number to determine the order it appears within
a gallery.
GalleryQuery is a class with a number of static methods that perform
operation on the backend sql server database. I'll refer to it as GQ in
the following for brevity
GQ.GetMinimumSe quenceNumber gets the lowest sequence number for a given
gallery
GQ.GetMaximumSe quenceNumber gets the highest sequence number for a
given gallery
GQ.GetSequenceN umber gets the sequence number for a specific image
GQ.PromoteImage swaps the sequence number of the chosen image with the
one above.
GQ.DemoteImage swaps the sequence number of the chosen image with the
one below
All of the above works as expected and if I check the backend database
after clicking a promote or demote button the relevent switch has
occured. Reviewing the page shows the switch has occured, however I
can't find a way of making the refresh occur without doing a
response.redire ct or server.transer back to the same page.
Unfortunately there are other controls on the page that lose their
state as a result.
I'm assuming that some thing is required at the points marked // ??? in
the code.
Any help greatly appreciated.
protected void CommandFunction (object source, DataListCommand EventArgs
e) {
int gallery = int.Parse(lstGa llery.SelectedV alue);
int min = GalleryQuery.Ge tMinimumSequenc eNumber(gallery );
int max = GalleryQuery.Ge tMaximumSequenc eNumber(gallery );
int current =
GalleryQuery.Ge tSequenceNumber (int.Parse(e.Co mmandArgument.T oString()),
gallery);
int currentImage = int.Parse(e.Com mandArgument.To String());
if (e.CommandName == "MoveUp") {
if (current min) {
GalleryQuery.Pr omoteImage(curr entImage, gallery);
// ???
}
} else if (e.CommandName == "MoveDown") {
if (current < max) {
GalleryQuery.De moteImage(curre ntImage, gallery);
// ???
}
}
}
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Martin Wulfe |
last post by:
I want to use a connection to an existing MS Access database, but I want
to be able to change which table is used to fill the datalist, using
VB6, at run time by late binding the datalist to the table. Using
either an ADO connection or an ADODC control, I can fill the datalist OK
the first time, but when I try to clear it and fill it from another
table, the contents of the datalist do not change. I must be doing
something really dumb...
|
by: Olav Tollefsen |
last post by:
I have a Web Form with a DataList. Inside the ItemTemplate, I have a
DropDownList control.
<asp:DataList ID="ProductDataList" Runat="server">
<ItemTemplate>
<asp:DropDownList ID="DropDownList1" Runat="server"
DataTextField="PropertyValue" DataValueField="PropertyValueId">
</asp:DropDownList>
</ItemTemplate>
</asp:DataList>
|
by: Vadivel Kumar |
last post by:
I have one datalist which contains one item template. In that, iam printing
a value taken from the sql table and one check box. Now, the user will
select some checkbox and press a button and that will be cached (or stored
in session). After storing i.e., after the page refresh, instead of printing
the checkbox i have to say "already selected" to stop the user to uncheck.
How to do this in asp.net? as far as session storing is concerned...
|
by: Jules_Anime |
last post by:
Is it possible to create an onclick event which is attached to individual
datalist items?
I have a Datalist with some details on employees, and when you click on one
we would like to open a new window which will be populated with some more
data on this employee.
The closest I have come is populating the
DataList.Attributes.Add("onclick","sUrl") with some information but when I
run the code it needs two clicks to open a window, and on...
|
by: schapopa |
last post by:
Hi,
I have nested datalist and I have some events that work, but I cannot
find out how to refresh child and parent datalist after executing events
on the child datalist.
My childdatalist is an user control.
Thank you for your help
Schapopa
| |
by: H5N1 |
last post by:
Hi there
My problem is that in when I update GridView row, which is nested into
DataList control, I want to refresh also DataList in which the GridView
is nested, since after update, trigger in my DB changes some value in
it (some Total sum from the GridView column).
The GridView, along with its ObjectDataSource is inserted into DataList
ItemTemplate.
|
by: H5N1 |
last post by:
Hello everybody
I'm stuck for a long time with the following problem, so I will be
really gratefull if you could help me a bit:
I have a GridView nested in DataList (it's located in DataList's Item
Template together with it's data source).
In OnRowUpdated event of child GridView I'm calling DataBind() on
parent DataList, since I want it to reflect the changes (maybe there's
|
by: AleXmanFree |
last post by:
Hi, I have this kind of problem,
In my asp.net page i use DataList and user control that is repeated in
DataList.
This user control has in it a checkbox , so everytime user clicks on
checkbox it goes postback.
But i cretaed new public static event in my user control class and
binding to this event function in my Page (that has in it user control
) and everytime when checkbox checked i call event that itself calls
method in Page class....
|
by: lee123 |
last post by:
i have a book i have bought from amazon.com called "visual basic 6.0 advanced topics" and in one of the examples it has something i have been trying to figure out for awhile it has a datalist and a datagrid the datalist i have filled with the database northwind database (customers tbl) and the datagrid i wanted to fill with the (orders tbl) i have set all the properties to what this book says but when i run the code it gives. it keeps giving me...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |