简体   繁体   English

我怎么增加任何数字

[英]how can i increase any number

I used repeater and I want to increase htmlcaption1 like htmlcaption2 , htmlcaption3 .... : 我使用了转发器,我想增加htmlcaption1例如htmlcaption2htmlcaption3 ....:

 <asp:Repeater ID="RepeaterBigBanner" runat="server">  
    <HeaderTemplate>  

    </HeaderTemplate>  
    <ItemTemplate>
         <img src="<%#DataBinder.Eval(Container.DataItem,"BannerPath")%>"alt="#htmlcaption1""  />
    </ItemTemplate>

    <SeparatorTemplate>  

    </SeparatorTemplate> 
</asp:Repeater>

cs side: CS端:

sqlConn.Open();
            sqlComm = sqlConn.CreateCommand();
            sqlComm.Connection = sqlConn;            
            sqlComm.CommandText = "select Top(11) * from BannerYonetim where GosterimYeri='W' and Aktif=0 and BaslangicTarihi<getdate() and BitisTarihi>getdate() order by BaslangicTarihi";       
            sqlComm.CommandType = CommandType.Text;

            SqlDataAdapter mySqlAdapter = new SqlDataAdapter(sqlComm);
            DataSet myDataSet = new DataSet();
            mySqlAdapter.Fill(myDataSet);
            RepeaterBigBanner.DataSource = myDataSet;
            RepeaterBigBanner.DataBind();

How can I increase alt="#htmlcaption1" like : #htmlcaption2 , #htmlcaption3 ... #htmlcaption11 ? 如何增加alt="#htmlcaption1"#htmlcaption2#htmlcaption3 ... #htmlcaption11

Thanks your answer 谢谢你的回答

I think you can try this : 我想你可以试试这个:

<ItemTemplate>
         <img src="<%#DataBinder.Eval(Container.DataItem,"BannerPath")%>" alt="<%# "#htmlcaption" + (Container.ItemIndex + 1).ToString() %>"  />
</ItemTemplate>

i don't find it very usefull to specify an alt in that case though... or at least not a different one as it doesn't describe the image. 我认为在这种情况下指定alt并不是很有用...或者至少没有其他含义,因为它没有描述图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM