我有一個GridView和一列GridView是一個模板,我添加一個日曆控件。達到asp.net控件,位於gridview控件內
我想達到的代碼隱藏該控制和編輯它,但我不知道如何實現這一目標。我可以達到上面的日曆只是寫calender1,因爲它在頁面上。我怎樣才能達到gridview內的日曆。
<asp:Calendar ID="Calendar2" runat="server" SelectedDate="2014-07-08"></asp:Calendar>
<br />
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="IsIlanId" DataSourceID="SqlDataSource1" OnRowCommand="GridView1_RowCommand" OnRowDataBound="GridView1_RowDataBound">
<Columns>
<asp:BoundField DataField="IsIlanId" HeaderText="IsIlanId" InsertVisible="False" ReadOnly="True" SortExpression="IsIlanId" />
<asp:BoundField DataField="Baslık" HeaderText="Baslık" SortExpression="Baslık" />
<asp:BoundField DataField="Icerik" HeaderText="Icerik" SortExpression="Icerik" />
<asp:BoundField DataField="YayinlanmaTarihi" HeaderText="YayinlanmaTarihi" SortExpression="YayinlanmaTarihi" />
<asp:BoundField DataField="BitisTarihi" HeaderText="BitisTarihi" SortExpression="BitisTarihi" />
<asp:CheckBoxField DataField="YayindaMi" HeaderText="YayindaMi" SortExpression="YayindaMi" />
<asp:BoundField DataField="FirmaResim" HeaderText="FirmaResim" SortExpression="FirmaResim" />
<asp:BoundField DataField="FirmaAdi" HeaderText="FirmaAdi" SortExpression="FirmaAdi" />
<asp:HyperLinkField DataNavigateUrlFields="IsIlanId" DataNavigateUrlFormatString="Ilan.aspx?id={0}" DataTextField="Baslık" />
<asp:ImageField DataImageUrlField="FirmaResim">
</asp:ImageField>
<asp:ButtonField ButtonType="Button" CommandName="cmSec" Text="Button" />
<asp:TemplateField HeaderText="Yayınlanma Tarihi">
<ItemTemplate>
<asp:Calendar VisibleDate='<%# Bind("YayinlanmaTarihi") %>' ID="Calendar1" runat="server" SelectedDate='<%# Bind("YayinlanmaTarihi") %>' ></asp:Calendar>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
檢查我的答案,並告訴我,如果有什麼不明確:) – mybirthname 2014-09-21 12:48:20