Go Back   Velocity Reviews > General Computer Discussion > Software
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread
Old 01-18-2008, 08:45 AM   #1
Default Don't want to load the page everytime when I clicked on any ImageButton in DataList


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;

}


tapasmahata
tapasmahata is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Show ImageButton of DataList as Thumbnail tapasmahata Software 0 01-15-2008 10:34 AM
How do find out if a button was clicked before the textchanged event of textbox fires Jack General Help Related Topics 0 10-27-2006 10:19 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46