用户操作
[即时聊天] [发私信] [加为好友]
ZPTID:IamBird
28194次访问,排名4422,好友0人,关注者0人。
IamBird的文章
原创 35 篇
翻译 0 篇
转载 18 篇
评论 8 篇
ZPT的公告
最近评论
dddfffddff123:那这样的话服务器主机就要支持.NET咯,是不是啊?
这样对服务器要求挺高的呀。
wszhoho:这些代码你真的测试过吗,我测试了第一种就失败了。
fmfeggman:兄弟 我试了你的方法好想不行
url=http://localhost:1323/WebSite6/Service.asmx/方法名;
url会报错
宽带用户:谁有权制定法律?只有议会
阿标:好文章!
文章分类
收藏
    相册
    asp.net
    我同事非说这个网赚很灵,陪她玩一下试试
    存档
    软件项目交易
    订阅我的博客
    XML聚合  FeedSky
    订阅到鲜果
    订阅到Google
    订阅到抓虾
    订阅到BlogLines
    订阅到Yahoo
    订阅到GouGou
    订阅到飞鸽
    订阅到Rojo
    订阅到newsgator
    订阅到netvibes

    转载 DataGrid中dropdownlist事件的触发ImageButton的事件触发收藏

    新一篇: Asp.net可输入下拉框服务器控件 C#版  | 旧一篇: Ajax实现无刷新三联动下拉框

    aspx页面部分代码:

    <asp:DataGrid id="DataGrid1" runat="server" AutoGenerateColumns="False">
        <Columns>
         <asp:BoundColumn DataField="txtId"></asp:BoundColumn>
         <asp:BoundColumn DataField="txtName"></asp:BoundColumn>
         <asp:TemplateColumn>
          <ItemTemplate>
            <asp:ImageButton id="btnItem" runat="server" CommandName="LookDetail"></asp:ImageButton>
            <asp:DropDownList id="ddl" runat="server" AutoPostBack="True">
             <asp:ListItem Value="asdf">asdf</asp:ListItem>
             <asp:ListItem Value="asdfasdf">asdfasdf</asp:ListItem>
             <asp:ListItem Value="wrwwewewee">wrwwewewee</asp:ListItem>
            </asp:DropDownList>
          </ItemTemplate>
         </asp:TemplateColumn>
        </Columns>
       </asp:DataGrid>

    cs部分代码:

    cs部分代码:

    /// <summary>
      /// 设计器支持所需的方法 - 不要使用代码编辑器修改
      /// 此方法的内容。
      /// </summary>
      private void InitializeComponent()
      {    
                  this.DataGrid1.ItemCreated += new System.Web.UI.WebControls.DataGridItemEventHandler(this.DataGrid1_ItemCreated);
                 this.DataGrid1.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_ItemCommand);
                 this.Load += new System.EventHandler(this.Page_Load);

      }

    private void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
      {
       if(e.CommandName=="LookDetail")
       {
        Response.Write("clicked item--->" + e.Item.Cells[0].Text);
       }
      }

      private void DataGrid1_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
      {
       DropDownList ddl=(DropDownList)e.Item.FindControl("ddl");
       if(ddl!=null)
       {
        ddl.SelectedIndexChanged+=new EventHandler(ddl_SelectedIndexChanged);
       }
      }

      private void ddl_SelectedIndexChanged(object sender, EventArgs e)
      {
       DropDownList ddl=(DropDownList)sender;
       Response.Write("当前选择的:" + ddl.SelectedValue);

       TableCell cell=(TableCell)ddl.Parent;
       DataGridItem item=(DataGridItem)cell.Parent;
               
       Response.Write("当前行:" + item.Cells[0].Text);
      }


     

    发表于 @ 2006年09月21日 09:50:00|评论(loading...)|编辑

    新一篇: Asp.net可输入下拉框服务器控件 C#版  | 旧一篇: Ajax实现无刷新三联动下拉框

    评论:没有评论。

    发表评论  


    当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
    Csdn Blog version 3.1a
    Copyright © ZPT