Saturday, March 10, 2012

datalist control in

In previous articles i explained how to bind data to dropdownlist and Gridview,Export Gridview data to PDF document,dynamically add rows to Grid view in using c#. Here i will show how to display the images with zooming option in Data list.Data list doesn't provide built in structure for presenting data.So we(developers) provide required custom structure.The Grid view is not applicable for this above requirement .because grid view comes with Table structure,This can not be changed.We can use Repeater for this Requirement
<Header Template>
</HeaderTemplate><Header Style Horizontal Align="center" BackCoor="aqua" ForeColor="Blue"/>
<asp:Lable id="l1" runat="server" Text='<% #Eval("name")%>'>
<asp:Image src='<% #Eval("name")%>' Height="60" Width="60">
<asp:Panel id="p1" runat="server" Height="60" Width="60" scrollBars="vertical">
<% #Eval("name")%>
<asp:CheckBox id="c1" runat="server" />
<asp:Button  id="btn" runat="server" Text="Zoom" CommandArgument='<% #Eval("name")%>'/>
<ItemStyle BackColor="Blue" Bordrcolor="Yellow" Borderstyle="Dotted"/>
No of wonders=<% #Datalist1.Items.count%>

Dabaselib.mycomponent obj=New databaselib.mycomponent();
Dataset ds=onj.Getinfo("useid="sa"; password=; Database="test","Select*from wonders");
When use click zoom button postback will takes place.ItemCommand event of datalist will be excuted.Item Command event will proivde Command Argument value of selected button
//Zoom when we clik on image
protected void Datalist1-itemCommand(Object sender, DataListCommandEventArgs e) 
The zoom.aspx will show the image with zooming

No comments: