Please anybody help to datagrid template column problem in asp.net

Discussion in 'C#' started by Ravikumar, Dec 22, 2006.

  1. #1
    could anybody help to solve my problem in asp.net

    i have used datagrid template column in asp.net, i have one function in code behind to return some string value, i want to display funtion retruned value to the datagrid template column label,this is method i have in my application,

    function string retvalue()
    {
    string testvalue="Monday/Thursday/Friday";
    if (testvalue.Equals("N/A"))
    {

    }
    else
    {
    string[] Loop=testvalue.Split('/');
    int[] DayValue=new int[Loop.Length-1];
    Test test=new Test();
    DayValue[0]=0;
    for(int i=0;i<=Loop.Length-1;i++)
    {
    int Retvalue=test.Format(Loop.ToString().Trim());
    if(DayValue[0]==0)
    {
    DayValue[0]=Retvalue;
    }
    else
    {
    if(DayValue[0] > Retvalue)
    {
    DayValue[0]=Retvalue;
    }

    }


    }
    }
    label1.Text=System.DateTime.Now.AddDays(DayValue[0]).ToShortDateString();
    return label1.Text;
    }
    i want display the return value to datagrid template column, please kindly tell the syntax ,please anybody help to solve this problem
     
    Ravikumar, Dec 22, 2006 IP
  2. venom

    venom Guest

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It would look something like this...

    
    <ItemTemplate>
         <asp:Label ID="Label2" runat="server"><%# retvalue() %></asp:Label>
    </ItemTemplate>
    
    Code (markup):
     
    venom, Dec 22, 2006 IP
  3. Ravikumar

    Ravikumar Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi venom thanks lot i got solution for this problem
     
    Ravikumar, Dec 22, 2006 IP