本文介绍了如何从radgrid中的选定行获取字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
如何从与eval绑定的radgrid中的选定行中获取字段?!

hihow can get field from selected row in radgrid binded with eval?!

     <telerik:RadGrid ID="kartabl"  runat="server" 

         >
        <ClientSettings EnablePostBackOnRowClick="true">
        <Selecting AllowRowSelect="True"></Selecting>
        </ClientSettings>
         <MasterTableView>
             <Columns>
                 <telerik:GridTemplateColumn  

                     FilterControlAltText="Filter column column" HeaderText="code" 

                     UniqueName="column">
                      <ItemTemplate>
                    <%#DataBinder.Eval(Container.DataItem, "rid").ToString()%>
                    </ItemTemplate>
                      <FooterStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                      <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                      <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="80px" />
                 </telerik:GridTemplateColumn>
                 <telerik:GridTemplateColumn

                     FilterControlAltText="Filter column1 column" HeaderText="type " 

                     UniqueName="column1">
                      <ItemTemplate>
                    <%#DataBinder.Eval(Container.DataItem, "rtype").ToString()%>
                    </ItemTemplate>
                      <FooterStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                      <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                      <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="150px" />
                 </telerik:GridTemplateColumn>
.
.
.





i写下代码但返回空字符串:



i write below code but return null string:

protected void kartabl_ItemCommand(object source, GridCommandEventArgs e)
      {

              if (e.CommandName == "RowClick")
              {

                  GridDataItem dataItem = e.Item as GridDataItem;
                  string str = dataItem["code"].Text;
                  HttpCookie objcookie1 = new HttpCookie("cookiref", str);
                  Response.Cookies.Add(objcookie1);
                  Response.Redirect("ShowRequestInfo.aspx");
              }
       }

推荐答案



这篇关于如何从radgrid中的选定行获取字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 20:10