質問編集履歴
2
コードの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -44,6 +44,9 @@
|
|
44
44
|
|
45
45
|
```ここに言語を入力
|
46
46
|
Protected Sub gv_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles gv1.RowCommand, gv2.RowCommand, gv3.RowCommand
|
47
|
+
If gv1.Rows.Count = 0 Then
|
47
|
-
|
48
|
+
Dim obj As Object = gv1.Controls(0).Controls(0).FindControl("btnAddFirstRow")
|
49
|
+
obj.focus()
|
50
|
+
End If
|
48
51
|
End Sub
|
49
52
|
```
|
1
コードの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -9,4 +9,41 @@
|
|
9
9
|
|
10
10
|
###試したこと
|
11
11
|
NETで調べた以下をやっても該当のコントロールは取得できずNothingがもどってきました。
|
12
|
-
GridView1.Controls[0].Controls[0].FindControl("TextBox1");
|
12
|
+
GridView1.Controls[0].Controls[0].FindControl("TextBox1");
|
13
|
+
|
14
|
+
|
15
|
+
```ここに言語を入力
|
16
|
+
<asp:GridView ID="gv1" runat="server" AutoGenerateColumns="False" GridLines="None" UseAccessibleHeader="False" Width="100%" BorderColor="#8D001C" BorderWidth="1px" ShowHeaderWhenEmpty="True">
|
17
|
+
<AlternatingRowStyle Wrap="False" />
|
18
|
+
<Columns>
|
19
|
+
<asp:TemplateField ShowHeader="False">
|
20
|
+
<HeaderTemplate>
|
21
|
+
<asp:Button ID="btnAddNew" runat="server" Text="Button" />
|
22
|
+
</HeaderTemplate>
|
23
|
+
<ItemTemplate>
|
24
|
+
<asp:Button ID="btnDelGv" runat="server" CausesValidation="false" CommandName="RowDelete" Text="削除" TabIndex="-1" CssClass="btn"/>
|
25
|
+
</ItemTemplate>
|
26
|
+
<ItemStyle VerticalAlign="Top" />
|
27
|
+
</asp:TemplateField>
|
28
|
+
<asp:TemplateField HeaderText="連番">
|
29
|
+
<ItemTemplate>
|
30
|
+
<asp:TextBox ID="ScSeq" runat="server" Text='<%# Bind("ScSeq")%>' Columns="1" TabIndex="-1"></asp:TextBox>
|
31
|
+
</ItemTemplate>
|
32
|
+
<ItemStyle VerticalAlign="Top" />
|
33
|
+
</asp:TemplateField>
|
34
|
+
</Columns>
|
35
|
+
<EmptyDataTemplate>
|
36
|
+
<asp:Label ID="lblGridHeader" runat="server" Text="" CssClass="lblGridHeader"></asp:Label>
|
37
|
+
<asp:Button ID="btnAddFirstRow" runat="server" CssClass="btn" OnClick="btnAddFirstRow_Click" Text="行追加" />
|
38
|
+
</EmptyDataTemplate>
|
39
|
+
<HeaderStyle BackColor="#8D001C" BorderColor="#8D001C" BorderWidth="1px" ForeColor="White" HorizontalAlign="Left" Wrap="False" />
|
40
|
+
<RowStyle BorderColor="#BD284C" Wrap="False" />
|
41
|
+
<SelectedRowStyle BackColor="#64FFFF" />
|
42
|
+
</asp:GridView>
|
43
|
+
```
|
44
|
+
|
45
|
+
```ここに言語を入力
|
46
|
+
Protected Sub gv_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles gv1.RowCommand, gv2.RowCommand, gv3.RowCommand
|
47
|
+
gv1.Controls(0).Controls(0).FindControl("btnAddFirstRow")
|
48
|
+
End Sub
|
49
|
+
```
|