Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > General Computer Discussion > Software > Don't want to load the page everytime when I clicked on any ImageButton in DataList

Reply
Thread Tools

Don't want to load the page everytime when I clicked on any ImageButton in DataList

 
 
tapasmahata tapasmahata is offline
Junior Member
Join Date: Jan 2008
Location: Kolkata
Posts: 7
 
      01-18-2008
Hi Everybody,

I am using a DataList in ASP.NET 1.1(C#) with some ImageButton. Images of the ImageButton binds at runtime and the DataList is binds when the page loads. I want to show a bigger view of the Image, showing in the ImageButton, in an another Image control. It displays it but everytime I click on the ImageButton the Whole page reloads again and again. So it takes a lot of time. Is there any way by which I can display image without reloading the whole page.

Regards
Tapas

HTML CODE:

<asp:datalist id="listImage" style="Z-INDEX: 101; LEFT: 440px; POSITION: absolute; TOP: 272px"
Height="152px" Width="416px" BorderColor="SkyBlue" runat="server" RepeatColumns="3" OnItemCommand="Show"
GridLines="Both">
<SeparatorStyle HorizontalAlign="Center" ForeColor="Aqua" BorderStyle="Solid" VerticalAlign="Middle"
BackColor="Fuchsia"></SeparatorStyle>
<ItemTemplate>
<P align="center">
<asp:ImageButton id=myImage Width="50px" Height="50px" CommandName="ShowImage" ImageAlign="Baseline" AlternateText='<%#DataBinder.Eval(Container.DataIt em,"pid") %>' Runat="server" ImageUrl='<%#DataBinder.Eval(Container.DataItem,"p id","http://mysite.com/demo/images/{0}.jpg")%>'>
</asp:ImageButton>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;
<asp:Label id="myLabel" Width="1px" Height="1px" Runat="server" Visible="False"></asp:Label>
<asp:Button id=myHiddenBtn1 runat="server" Width="80px" Height="24px" Text='<%# DataBinder.Eval(Container.DataItem,"pname")%>' Visible="False">
</asp:Button>
<asp:Button id=myHiddenBtn2 runat="server" Width="80px" Height="24px" Text='<%# DataBinder.Eval(Container.DataItem,"psize")%>' Visible="False">
</asp:Button><!%# DataBinder.Eval(Container.DataItem,"pname")%></P>
</ItemTemplate>
</asp:datalist>

Code Behind :

//These functions are only to show the image with bigger view in a Image
//control. Please Help me....

public void Show(Object s, DataListCommandEventArgs e)
{

ImageButton anImage=(ImageButton)e.Item.FindControl("myImage") ;
Label anLabel=(Label)e.Item.FindControl("myLabel");
if(anImage.CommandName=="ShowImage")
{
string pcode;
//btnAddToCart.Enabled=true;
//Label1.Text=anImage.AlternateText;
pcode=anImage.AlternateText;
ViewImage(pcode);


}
Button Btn1=(Button)e.Item.FindControl("myHiddenBtn1");
Button Btn2=(Button)e.Item.FindControl("myHiddenBtn2");
Label1.Text=Btn1.Text+" | "+Btn2.Text;

}

public void ViewImage(string sa)
{
//Label1.Text=sa;
imgShow.ImageUrl="http://mysite.com/demo/images/"+sa+".jpg";
imgShow.AlternateText=sa;

}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
501 PIX "deny any any" "allow any any" Any Anybody? Networking Student Cisco 4 11-16-2006 10:40 PM
ImageButton inside of a WebPart not firing Clicked Event Brian McCarty ASP .Net Web Controls 1 01-19-2006 01:29 AM
Setting up a datalist control - Item_DataBound for a datalist in a datalist Nevyn Twyll ASP .Net 8 09-09-2004 10:13 PM
imagebutton clicked in a datagrid EMW ASP .Net 0 07-02-2004 03:04 PM
How to set focus on TextBox web control for the clicked event of ImageButton. Gill Smith ASP .Net 1 05-21-2004 06:02 PM



Advertisments