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

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

function & datalist

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :ASP.Net

I have a function called selType that returns either "mc" or "car"

Then in my datalist i would like to check if the function returns "mc" it should output pName, else pNameFI from my db.

I need something like this..

<%# if selType="mc","pName","pNameFI") %>

But this don't work.. I don't know how to achieve this.. Can anyone help me?

View Complete Post

More Related Resource Links

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

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>   

  • 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?

    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

    Content page control passes as argument to javascript function


    Here is the content page:


    <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="JavaDynamicCopyValue.aspx.cs" Inherits="JavaDynamicCopyValue" Title="Untitled Page" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
     <script type="text/javascript" >
     function copyValue(input, output )
       ouput.value = input.value;
       return true;
     <asp:TextBox ID="txt1" runat="server" onchange="copyValue(this,document.getElementById('<%=txt2.ClientID%>'))"></asp:TextBox>
        <br />
        <br />
        <asp:TextBox ID="txt2" runat="server"></asp:TextBox>


    I got a javascript run time error says output is undefined. if I view source of the page, the txt1 markup became:

    <input name="ctl00$ContentPlaceHol

    connection to SQL Server files (*.mdf) require SQL server express 2005 to function properly.


    I dont have the SQL EXPRESS installed instead I have SQL Standard Edition.

     I have two SQL Server instances installed.

     1- UserLT (this is sql 2000)
    2- UserLT\SQL2005 (this is SQL 2005 named instance)

    But when i try to add a database to my VS website project I get the following error:

    Connection to SQL Server files (*.mdf) require SQL server express 2005 to function properly. please verify the installation of the component or download from the URL: go.microsoft.com/fwlink/?linkId=4925

    I went in Tools>Opetions>DataBase tools>Data Connection>Sql Server Instance Name (blank for default)

    and changed the "SQLEXPRESS" to "USERLT\SQL2005".

    But I still get the same error message. Any ideas how i can resolve this issue?

    Public Shared function doubt????

    I am using VB.net/ASP.NET and SQL Server 2000 for a web application.

    For populating the dropdowns, I wrote a Public Shared function LoadDDL(), in which I pass the dataset and dropdown name to set.

    I have my doubts that this function will produce unexpected results for concurrent users. And will mix the results among sessions because it is a Shared function.

    I am confused here. Is it the right way to go?

    Please advice. Thanks in advance.


    Trim function in C Sharp

    How do i use "trim" function in C Sharp? I have a string and i want to strip off spaces from the end of the string. Any idea how do i do it??


    Pure C++: Invoking Generic or Function Templates


    As I promised last time, in this month's column I'll walk through the process of defining and invoking a generic or template function under C++\CLI. A function template or a generic function begins with the template or generic keyword followed by its parameter list.

    Stanley B. Lippman

    MSDN Magazine October 2005

    Cutting Edge: Using an Eval Function in Web Services


    Web Services are often presented as the perfect tool for pro-grammers. They're interoperable, based on open standards such as SOAP and WSDL, and are fully integrated with the Microsoft® . NET platform.

    Dino Esposito

    MSDN Magazine September 2002

    way of calling "javascript function of parent window from child window."

    The article way of calling "javascript function of parent window from child window." was added by raja.s on Sunday, June 06, 2010.

    Hi,Here i am going to explain how to call the javascript function of a parent window from the child window(pop-Up).Some may know before reading this post.Parent Java Script Function:script language="Javascript" type="text/javascript">

    Need function to find difference between two dates


    Hi all

    I need a function written in vb to find the exact month difference between two dates.

    For example

        Start Date : 01/01/2010

        End Date   : 15/02/2010

     then the difference value should be like this 1.5  i.e i need the difference in decimal value.

    >>>How to use javascript function in aspx file?



    I have a file util.js and there some funtions in same file.

    For example functions name are keyUp, keyDown, isNumeric, isAlphaNumeric

    I have used these functions in aspx code behind in a textbox to restrict user that he may not be able to input any special character.

    Before, I used the code directly in aspx file but I have do it for different textboxes therefore to avoid much coding in aspx file I created util.js and put all code in this file but how to use these particular functions in aspx file I couldn't find the way.

    Anyone have idea. Do share with me.

    I used the reference like this:


    ' Font-Names="Verdana" Font-Size="8pt" Onkeyup= "keyUp(event.keyCode)" Onkeydown="return isAlphaNumeric(event.keyCode);" onpaste="return false;">

    ERROR [S1000] [Microsoft][ODBC Visual FoxPro Driver]Function name is missing ).


    I Am Continiously Getting Error For Following Line Of Code, It Work  Fine In Other Database

    Am I Doing Any Mistake

    if (sh3itno != "" && dpsh3no != "")
                    string queryy = "SELECT [CHEQNO] FROM [SH3MAST] WHERE (([CHEQDATE] = " + chqdate + ") AND ([FAVOUR] = " + favour + ") AND ([CHQTYPE] = " + ctype + ") AND ([TRSTN] = " + trstn + ") AND ([TRBANK] = " + trbank + ") AND ([SH3ITNO] = " + sh3itno + ") AND ([DPSH3NO] = " + dpsh3no + "))";
                    OdbcCommand cmd3 = new OdbcCommand(queryy, connen1);
                    string chqno =cmd3.ExecuteScalar().ToString(); (Here Iam Getting Error)
                    tbl.Rows[i]["cheque no"] = chqno;
    Stack Trace: 
    [OdbcException (0x80131937): ERROR [S1000] [Microsoft][ODBC Visual FoxPro Driver]Function name is missing ).]
       System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode) +39
       System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, Strin
    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