2013-03-01 26 views
2
<ItemTemplate> 
    <tr class="odd gradeX"> 
     <td> 
     <%#Eval("Caption")%> 
     </td> 
     <td> 
     <%#Eval("CreatedBy")%> 
     </td> 
     <td> 
     <%#Eval("CreationDate")%> 
     </td> 
     <td> 
     <%#Eval("Status")%> 
     </td> 
     <td class="center"> 
     <div class="controls center"> 
      <a href="NewsCommentEdit.aspx?mtid =<%#Eval("UserId")%>" title="Güncelle" class="tip"> 
       <span class="icon12 icomoon-icon-pencil"></span> 
      </a> 
     </div> 
     </td> 
     <td> 
     <asp:HiddenField runat="server" ID="hdnComment" Value='<%#Eval("NewsCommentId")%>' /> 
     <asp:DropDownList runat="server" ID="ddlStatus" AutoPostBack="True" OnSelectedIndexChanged="ddlStatus_Changed"> 
      <asp:ListItem Text="Onay Bekliyor" Value="0"></asp:ListItem> 
      <asp:ListItem Text="Onaylandı" Value="1"></asp:ListItem> 
      <asp:ListItem Text="Reddedildi" Value="2"></asp:ListItem> 
     </asp:DropDownList> 
     </td> 
    </tr> 
</ItemTemplate> 

我想在ddlStatus的選定索引更改事件中獲取hdnComment的值。這是可能的和如何?如何從同一個中繼器項目中的dropdownlist的selecetedchanged事件獲取中繼器項目中的控件的值?

回答

3
protected void ddlStatus_Changed(object sender, EventArgs e) 
    { 
     string value; 
     HiddenField comment = ((Control)sender).Parent.FindControl("hdnComment") as HiddenField; 
     if (comment != null) 
     { 
      value = comment.Value; 
     } 
    } 
相關問題