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>
&n bsp;
<P>   ;
<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;
}
|