Click here to Skip to main content
15,889,403 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a schedule calender with a template field.

XML
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<contenttemplate>
<rw:schedulecalendar id="Schedule1"  runat="server" StartOfTimeScale="08:00:00"
ShowValueMarks="True" EndOfTimeScale="17:00:00" BorderColor="#D04C87" 
DateField="EventDate" StartTimeField="StartTime" EndTimeField="EndTime" ItemStyleField="Color"
Layout="Vertical" GridLines="Both"  CellSpacing="0" 
DataKeyNames="ID" HorizontalAlign="NotSet" 
StartDay="Monday" EnableEmptySlotClick="True" 
meta:resourcekey="Schedule1Resource1" StartDate="2010-04-05" Weeks="1" 
FullTimeScale="True" CellPadding="0">

<timetemplate>
<%# Convert.ToDateTime(Container.DataItem).ToShortTimeString() %></timetemplate>
<datestyle cssclass="title"></datestyle>

<datetemplate>
<%# Convert.ToDateTime(Container.DataItem).ToString("ddd") ></datetemplate>
<backgroundstyle cssclass="bground"></backgroundstyle>
<itemstyle cssclass="item" height="30px" wrap="True"></itemstyle>
<timestyle cssclass="rangeheader"></timestyle>

<itemtemplate>
<asp:LinkButton id="LinkButton1" runat="Server" CommandName="Select" ><%#Eval("Subject")%></asp:LinkButton>
</itemtemplate>

</contenttemplate>


And then I bind the dataset with schedule calendar in code.
C#
Schedule1.DataSource = _Ds;
Schedule1.DataBind();

but link button don't get the value.pls any one help me
Posted
Updated 8-Apr-11 18:24pm
v5
Comments
Albin Abel 8-Apr-11 8:14am    
It seems like you are using a wrong hierarchy. You are putting the update panel direct under the template field?. Inside template field only templates has to be there. Inside the template you can have any fields.

try this way

XML
<asp:HyperLink ID="hyp_Edit" ImageUrl="~/Admin/Images/edit.jpg" NavigateUrl='<%#"~/Admin/CandidateDetails.aspx.?Id="+Eval("CandidateID") %>'
                                               Text='<%#Eval("IsFresher")%>' runat="server"></asp:HyperLink>
 
Share this answer
 
Comments
Rajisha Aravind 8-Apr-11 7:51am    
My problem is not getting the value in Eval("Subject") in item template
Mahendra.p25 8-Apr-11 7:59am    
Check in the DataSet table Column Name is Same as (Subject) or not and It has values in it or not.

i have tried this and its working <asp:LinkButton ID="LinkButton1" runat="server"><%#Eval("IsFresher")%>
Rajisha Aravind 8-Apr-11 8:03am    
The dataset column name is also Subject and also it has values.But I can't understand the why don't get the value
Rajisha Aravind 9-Apr-11 1:11am    
for checking,I give a textbox in itemtemplate with text.
ie,
<itemtemplate>
<asp:TextBox ID="TextBox1" runat="server" Text="Testing">


But even the textbox also not displaied
your link button end tag is missed:

<asp:linkbutton id="LinkButton1" runat="Server" commandname="Select" >
<%#Eval("Subject")%>



and if you call your bind method from repeter Item command or any other repeter event then one post back needed to bind it.

ScriptManager.RegisterStartupScript(this, this.GetType(), "Postback", "postback();", true);


javascript:

postback()
{
  _dopostback('LinkButton1','');
}
 
Share this answer
 
v2
Comments
Rajisha Aravind 9-Apr-11 0:26am    
In Pageload with in the (!ispostback) , I bind the datasource with the schedulecalendar
You may wrap in this hierarchy

XML
<asp:TemplateField>
    <ItemTemplate>
            <asp:UpdatePanel runat="server">
                <ContentTemplate>
                    <asp:LinkButton id="LinkButton1" runat="Server" CommandName="Select" ><%#Eval("Subject")%></asp:LinkButton>
                </ContentTemplate>
            </asp:UpdatePanel>
      </ItemTemplate>
</asp:TemplateField>


Put everything inside an outer item template. If the subject is present in your result set it supposed to be bound, else debug your data source
 
Share this answer
 
Comments
Rajisha Aravind 9-Apr-11 0:43am    
I gave the update panel with in the itemtemplate. But not get the value in linkbutton
Albin Abel 9-Apr-11 0:47am    
That means your result doesn't has the subject. One of your previous replay says "In Pageload with in the (!ispostback) , I bind the datasource with the schedulecalendar", this means only one time the data source is available. when post back the grid will be empty. You need to debug the data source and check the datasource contains the necessary information.
Rajisha Aravind 9-Apr-11 1:00am    
You say that the datasource available at one time.It fine . But at that time the dataset value could not bind in itemtemplate of schedulecalendar

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900