首页 新闻 会员 周边

怎么根据GridView的一个值修改另一个值

0
悬赏园豆:20 [待解决问题]

前台代码

 <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" AllowPaging="True"
                            PageSize="14" OnPageIndexChanging="GridView1_PageIndexChanging" OnRowDataBound="GridView1_RowDataBound"
                            SelectedRowStyle-BorderColor="Blue" SelectedRowStyle-Font-Bold="true"
                            SelectedRowStyle-Font-Size="Larger"
                           >
                            <Columns>
                                <asp:BoundField DataField="number" HeaderText="排名" />
                                <asp:BoundField DataField="unit_name" HeaderText="单位" />
                                <asp:TemplateField HeaderText="运动员">
                                    <ItemTemplate>
                                        <a title="<%# Eval("sporters_name")%>" href='play.aspx?number=<%# Eval("number")%>&playact_id=<%# Eval("playact_id") %>&game_id=<%# Eval("game_id")%>&value_k=1'>
                                           <%#strFormat((string) Eval("sporters_name"))%></a>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="get_score" HeaderText="总分" />
                            </Columns>
                            <SelectedRowStyle ForeColor="#CC0000" />
                        </asp:GridView>

后台代码

this.GridView1.DataSource = DBHelper.GetDataSet(sql1).Tables[0]; ;
            this.GridView1.DataBind();
            for (int i = 0; i <= GridView1.Rows.Count - 1; i++)  //循环查找开始 
            {
                string score = GridView1.Rows[i].Cells[0].Text.ToString();
                            if (score == "-1")
                {
                    GridView1.Rows[i].Cells[0].Text = "弃权";
                                  }
                             }

怎么根据number是否为-1,-1的时候不用a标签,就是不要用超链接。

DoLu的主页 DoLu | 初学一级 | 园豆:132
提问于:2013-03-18 16:44
< >
分享
所有回答(2)
0

怎么没有人帮忙呀???、

DoLu | 园豆:132 (初学一级) | 2013-03-19 15:04
0

我记得好像是在OnRowDataBind事件里处理的。不做这个太久了记不清了。

luofer | 园豆:468 (菜鸟二级) | 2013-03-19 18:14
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册