首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

怎的获取GridView中的TextBox 的值

2011-12-21 
怎样获取GridView中的TextBox 的值asp:GridViewID gvStage runat server CellPadding 0 AutoGen

怎样获取GridView中的TextBox 的值
<asp:GridView   ID= "gvStage "     runat= "server "   CellPadding= "0 "   AutoGenerateColumns= "False "
                                BorderStyle= "None "   BorderWidth= "0px "   Width= "100% ">
                                            <Columns>
                                                    <asp:TemplateField>
                                                            <HeaderTemplate>
                                                                <table   width= "100% "   border= "0 "   cellpadding= "5 "   cellspacing= "0 "   bgcolor= "#FFFFFF "   class= "FrameLiteGray "   id= "TABLE1 ">
                                                                        <tr   bgcolor= "#eeeeee "   class= "En10BlackStrong ">
                                                                                <td   height= "25 "   align= "left "   width= "25% ">
                                                                                        Stage </td>
                                                                                <td   width= "25% "   align= "left "   >
                                                                                        Step </td>
                                                                                <td   width= "7% "   align= "center "   >
                                                                                        Standtard   cycle   time </td>


                                                                                <td   width= "9% "   style= "word-break:break-all "   align= "center "   >
                                                                                        Days   to   first   container   deliver   after   completion   of   this   action </td>
                                                                                <td   width= "7% "   style= "word-break:break-all "   align= "center "   >
                                                                                        Completes   this   step   surplus   time </td>
                                                                                <td   width= "10% "   align= "left "   >
                                                                                        Actual   time </td>
                                                                                <td   width= "7% "   align= "center "   >
                                                                                        Date   of   completion </td>
                                                                        </tr>
   
                                                            </HeaderTemplate>
                                                           


                                                            <ItemTemplate>
                                                                      <tr   class= "En12Black ">
                                                                                <td     width= "25% "   style= "word-break:break-all "   valign= "top "   align= "left "   >
                                                                                        <%#   Eval( "RequestTypeStageName ")%> </td>
                                                                                <td   colspan= "6 "     valign= "top "   width= "75% "   align= "left "   >
                                                                                    <!--放步骤的gridView-->  
                                                                                        <asp:GridView   ID= "GridView2 "   runat= "server "   AutoGenerateColumns= "False "   BorderStyle= "None "
                                                                                                BorderWidth= "0px "   CellPadding= "0 "   DataSource= ' <%#   bindStep(Eval( "RequestTypeStageID ").ToString())   %> '
                                                                                                ShowHeader= "False "   Width= "100% "   OnRowDataBound= "GridView2_RowDataBound "   OnRowCommand= "GridView2_RowCommand ">
                                                                                                <HeaderStyle   Wrap= "False "   />


                                                                                                <Columns>
                                                                                                        <asp:BoundField   DataField= "RequestTypeStepID "   Visible= "False "   />
                                                                                                        <asp:TemplateField>
                                                                                                                <ItemTemplate>
                                                                                                                        <table   border= "0 "   cellpadding= "0 "   cellspacing= "0 "   width= "100% ">
                                                                                                                                <tr   class= "En12Black ">
                                                                                                                                        <td   align= "left "   height= "25 "   style= "word-break:   break-all "   valign= "top "   width= "34% ">
                                                                                                                                                <%#   Eval( "RequestTypeStepName ")%>


                                                                                                                                        </td>
                                                                                                                                        <td   align= "center "   style= "word-break:   break-all "   valign= "top "   width= "10% ">
                                                                                                                                               
                                                                                                                                                <asp:Label   ID= "CompletesTime "   runat= "server "   Text= ' <%#   Eval( "CompletesTime ")   %> '> </asp:Label>
                                                                                                                                        </td>
                                                                                                                                        <td   align= "center "   style= "word-break:   break-all "   valign= "top "   width= "13% ">
                                                                                                                                                <%#   Eval( "FromFirstTime ")%>


                                                                                                                                        </td>
                                                                                                                                        <td   align= "center "   style= "word-break:   break-all "   valign= "top "   width= "13% ">
                                                                                                                                                <asp:Label   ID= "SurplusTime "   runat= "server "   Text= ' <%#   Eval( "RequestTypeStepID ")   %> '> </asp:Label> </td>
                                                                                                                                        <td   align= "left "   style= "word-break:   break-all "   valign= "top "   width= "13% ">
                                                                                                                                                <asp:TextBox   ID= "ActualTime "   runat= "server "   Width= "35px "> </asp:TextBox> <asp:Button
                                                                                                                                                        ID= "Button1 "   runat= "server "   Text= "Completes "   Width= "70px "   CommandArgument= "Btn "/> <asp:Label   ID= "labActualTime "


                                                                                                                                                                runat= "server "   Text= " "> </asp:Label> </td>
                                                                                                                                        <td   align= "center "   style= "word-break:   break-all "   valign= "top "   width= "10% ">
                                                                                                                                              <asp:Label   ID= "DateOfCompletion "   runat= "server "> </asp:Label>
                                                                                                                                        </td>
                                                                                                                                </tr>
                                                                                                                        </table>
                                                                                                                </ItemTemplate>


                                                                                                        </asp:TemplateField>
                                                                                                </Columns>
                                                                                        </asp:GridView>
                                                                               
                                                                                </td>
                                                                             
                                                                        </tr>
                                                            </ItemTemplate>
                                                            <FooterTemplate>
                                                                    </table>
                                                            </FooterTemplate>
                                                    </asp:TemplateField>
                                            </Columns>


                               
                                    </asp:GridView>

前台代码是这样的,我现在想点击Button获取输入的TextBox   的值,这个怎样实现啊

[解决办法]
findContorl( "textboxid ")
[解决办法]
太乱,看不清
一般是:((TextBox)GridView1.Rows[i].Cells[j].FindControl( "TextBoxID ")).Text
[解决办法]
GridViewRow gvrRoles = gvRoles.Rows[gvRoles.EditIndex];
string strRoleName = ((TextBox)gvrRoles.FindControl( "txtRoleName ")).Text.Trim();
或者
TextBox chkEFlag1 = (TextBox)e.Row.FindControl( "txtRoleName ");
[解决办法]
document.getelementbyid( 'GridView1 ').rows(0).scell( '0 ').innert;
是这样的思路,写的可能不对,自己更正吧

热点排行