.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

datalist itemtemplate

Posted By:      Posted Date: October 22, 2010    Points: 0   Category :ASP.Net


i have a datalist with a radiobutton as one of the itemtemplates. But i cudn't access this radiobutton in its events..plzz help..

View Complete Post

More Related Resource Links

Function Call in DataList, ItemTemplate

Here is a portion from my code:

<asp:DataList id="dlItems" runat="server" DataKeyField="prod_id" OnEditCommand="AddToCart">
        <img src='<%# DataBinder.Eval(Container.DataItem, "prod_imageurl") %>' />

Please I want to replace this line
    <img src='<%# DataBinder.Eval(Container.DataItem, "prod_imageurl") %>' />
with something like:
    <%# displayImage(DataBinder.Eval(Container.DataItem, "prod_imageurl"))%>
because I want to do some processing on the image before displaying it.

Does anyone knows the best way to accomplish this?

Textbox in ItemTemplate inside Gridview, unable to get the value


Hi. I have a itemtemplate inside a gridview.

<asp:TemplateField HeaderText="Enter OTP">
                            <asp:Label ID="Label2" runat="server"
                                style="font-family: Arial, Helvetica, sans-serif; font-size: x-small"
                                Text="PIN Num:"></asp:Label>
                            &nbsp;<asp:TextBox ID="txtPIN" runat="server" Height="21px" Width="100px"></asp:TextBox>

datalist image slide show problem


hi friends

i am binding  images dynamically(back end)for a datalist .iam applying a slideshow for it .I am getting a problem to apply slideshow for dyanmically binded images.If the define in a div statically it working perfectly

for example pls go through my code below:

<script type="text/javascript">
$(document).ready(function() {
        fx: 'scrollLeft' // choose your transition type, ex: fade, scrollUp, shuffle, etc...

<div class="slideshow">
        <img src="images/30_dummy.jpg" width="200" height="200" />
        <img src="images/aquarius.gif" width="200" height="200" />
        <img src="images/star.gif" width="200" height="200" />
        <img src="images/the-proud-indian-flag-1.jpg" width="200" height="200" />

I above code works perfectly and the slide show e

Datalist with embedded Grid or List...Sub Totals issue with iteration


Let me see if one of you can assist with this one...


i have a similar situation, but mine does not use the selected item (item Command). Here is what the form is to do:


1. this is for an educational environment, so we use SID- NOT SSN's, but i use the SID as a filter in the subset as the grouping unique id.

2. I'm trying to inject a sub total row at the last line item of each SID (if more than one item in the report for that SID).

3. I'm looping thru the items in the Datalist Item Command with a for each (item i in Datalist2.Items).

how can i display the selected value of dropdownlist from edittemplate to label from itemtemplate?


I have a detailsview with a dropdownlist in it. the detailsview is connected to a database table(employees having the following fields: id-smallint,name-nvarchar, departmnet-smallint). the ddl is connected to another table (departments with the following fields: id-smallint, departmentName-nvarchar). the ddl is in the edititemTempalte of the department field. My goal is to display in  the itemtemplate the departmentName (the selected value from the edititemtemplate ). How can I do this? Doyou have any ideas?

thanks a lot

Filter in datalist


Hello all,

i have an question. I have two table's in my database.

One filled with persons, where de PK is a guid,

Second is a table with records of those persons and a date field with it's own PK "ID".

Now i want to fill  a datalist with all the persons whom arent in the second table between a given date.


anyone tips on how to accomplish that, I am using linq2sql..


Thanks in advance..





accessing values from a database with datalist?


I have a datalist and I am filling it using a dataadapter, dataset. So in my .ascx page, I have

<asp:datalist runat="server" id="dlProducts" repeatcolumns="2" repeatdirection="horizontal">


<table border="0">

<tr><td><%# Eval("Item_Name") %></td></tr>

<tr><td>I have to add a picture here</td><td><%# Eval("First_Name") %></td></tr>




In the area where I have put a statement like "I have to add a picture here", I have write a big case statement.  Like:

Case: 6 // show a picture from file1

case: 7 // show a picture from file2

Case 8: //show a picture from file3


So How do I do this here?  Because I dont know how to access the datalist values from code behind.


Here is my code behind:

SQLString = "SELECT First_Name, Picture, item_name, item_id from table1 where item_id = " + request.querystring["iid"];

dataadapter daItems = new dataadapter(SQLString, "connection_name");

dataset dsItems = new dataset();



javascript function not working with datalist


I have a datalist and there is a check box within this datalist in a .ascx page.  But I have to have an image out side the datalist.  So here is the code and its not owrking.  When I click on the image, I dont see any alert box. 


<script Language="JavaScript" type="text/javascript">


function validate_checkbox()



// set var checkboxSelect to zero

var checkboxSelect = 0;

var sProducts = "";


var multiCheck = window.document.forms["frmCompare"].CompareCheck.length;


if (multiCheck != null)


    // Loop from zero to the one minus the number of checkbox button selections

    for (counter = 0; counter < window.document.forms["frmCompare"].CompareCheck.length; counter++)


        if (window.document.forms["frmCompare"].CompareCheck[counter].checked)


            var seperator = (checkboxSelect > 0)?",":"";

            sProducts += sep

How to format an ItemTemplate value on a gridview control


I have the following in a GridView control:

<asp:TemplateField HeaderText="Count">
         <asp:Label id="lblicount" runat="server" Text='<%# Eval("icount") %>'>

Sometimes the value of this is 0.  I want to display nothing or a blank if the value is 0.  How do I do this?



from datalist to gridview


hi guys


I have a problem, I wanna Insert that cridentials with gridview but I can't , I could that with datalist , so how can I do this with grid view

if there is a sample code i be happy

thanks to everybody..





Sub InsertAllBasketItems()

Dim productAPI As New basketTableAdapters.OrdersTableAdapter

For Each Item As DataListItem In DataList1.Items

datalist printOut() function Problem

  • i m using below code..by using it i able to write asp data into word file n format it.but i m facing problen in print out..

    it show exception

    Message = "The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED))"

    please hav a look at below code....

  •  .................div data...................   
  •   <div id="printdiv" runat="server">   
  •     <table style="border: 5px solid #FF00FF; width:100%">   
  •     <tr>   

  • Custom Datalist rows

    Hi,I am use data list to display the three record and after showing the three record in one row then i want add the one row and then again the three row likedata..|data..|data..Single row...........Data..|Data..|data..Single row............so plz help me outThanks in advance

    DataList First Record Different Color

    I have a DataList that I would like to display the background color of the first record as a different color from the rest of the records.Is this even possible?  Any examples or suggestions would be appreciated.

    Datalist Dynamic Page Break

    Hello all,I am in a big trouble this timeFollowing is the Scenario:I have a datalist control in which page break is added according to user choicei.e I can't fix page size because if user add pagebreak then the records will displayed from next pagehe can add page breaks between the records also as follows:-----------------------------------------------------------------PageBreak1Record1Record2PageBreak2Record3 Record4Record5 Record6PageBreak3Record7 Record8 Record9PageBreak4PageBreak5Record10 Record11----------------------------------------------------------------- As you can see the issue have dynamic page size (although i already implemented datalist paging but in that we fix page sizefor PagedDataSource)i.e                DataView dv = new DataView(dt);                objPds.DataSource = dv;                objPds.AllowPaging = true;                objPds.PageSize = 4;                objPds.CurrentPageIndex = CurrentPage;              

    DataList and DetailsView problem

    I have a problem hooking up the datalist to the details view. I know everything server side is fine cause the default values work, but I guess I am not getting post back from the datalist. Here is my code.<div id="thumbnail">                     <asp:DataList ID="DataList1" runat="server" DataSourceID="ObjectDataSource2"                          RepeatDirection="Horizontal" DataKeyField="ItemsID">                         <ItemTemplate>                             <asp:ImageButton ID="Image1" runat="server" ImageUrl='<%# "Handler.ashx?ItemsID=" + Eval("ItemsID")%>'/>                             <asp:Button ID="button1" runat="server" Text='<%# Eval("ItemsID") %>' />                         </ItemTemplate>                     </asp:Dat

    Update progress within a datalist

    I have an update panel and then a datalist and then a nested datalist...it looks like this:   <update panel>      <datalist1>            <datalist2>            </datalist2>      </datalist> </updatepanel>   Problem is, within datalist 2, I have some linkbutton's and I'd like to show a progress "gif" (update progress) when the button is clicked.  I can create the update progress, but when you click the button, you get the "gif" shown for every item in the nested datalist.  Anyone know how I can identify where I am in the datalist (which linkbutton) and only show the progress "gif" for that button? Thanks in advance for any help! Mike    
    ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
    Sql Server  SharePoint  Silverlight  Others  All   

    Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend