I don't understand what's going on here. Would someone help me
understand this better.
So in asp.net I have something like this below (vb version):
'---------------------- this part is in the partial page class
Protected Sub snTBx_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
sender.Text = Me.MakeRandom()
End Sub
'---------------------- (the asp page)
<asp:FormView ID="FormView1" CssClass="signuptable" runat="server"
DataKeyNames="ID" DataSourceID="SqlDSource"
OnPageIndexChanging="FormView1_PageIndexChanging"
OnInserting="FormView1_ItemInserting" DefaultMode="Insert"
Width="288px" Height="251px" CellPadding="10">
<InsertItemTemplate>
<span class="signuplabel">name:</span><br />
<asp:TextBox ID="nTBx" runat="server" Text='<%#
Bind("name") %>' Width="250px"
AutoCompleteType="FirstName"></asp:TextBox><br />
<span class="signuplabel">email:</span><br />
<asp:TextBox ID="eTBx" runat="server" Text='<%#
Bind("email") %>' Width="250px"
AutoCompleteType="Email"></asp:TextBox><br />
<asp:TextBox ID="snTBx" runat="server" Text='<%#
Bind("srnumbr") %>' Visible="False" Height="0px"
OnLoad="snTBx_Load"></asp:TextBox><br />
<asp:Button ID="InsertButton" runat="server"
CausesValidation="true" CommandName="Select" Text="Sign me up"
UseSubmitBehavior="false" OnClick="InsertButton_Click" />
</InsertItemTemplate>
</asp:FormView>
So I decided to convert that to c#. Everything started working well
until the sender. Anyhow this is how the above converts over to c#
//---------------------- the partial page class
protected void snTBx_Load(object sender, EventArgs e){
sender.Text = this.MakeRandom();
}
//---------------------- (the asp page)
<asp:FormView ID="FormView1" CssClass="signuptable" runat="server"
DataKeyNames="ID" DataSourceID="SqlDSource" DefaultMode="Insert"
Width="288px" Height="251px" CellPadding="10">
<InsertItemTemplate>
<span class="signuplabel">name:</span><br />
<asp:TextBox ID="nTBx" runat="server" Text='<%#
Bind("name") %>' Width="250px"
AutoCompleteType="FirstName"></asp:TextBox><br />
<span class="signuplabel">email:</span><br />
<asp:TextBox ID="eTBx" runat="server" Text='<%#
Bind("email") %>' Width="250px"
AutoCompleteType="Email"></asp:TextBox> <br />
<asp:TextBox ID="snTBx" runat="server" Text='<%#
Bind("srnumbr") %>' Visible="true" Height="10px"
OnLoad="snTBx_Load">sadfasdfsa</asp:TextBox><br />
<asp:Button ID="InsertButton" runat="server"
CausesValidation="true" CommandName="Select" Text="Sign me up"
UseSubmitBehavior="false" OnClick="InsertButton_Click" />
</InsertItemTemplate>
</asp:FormView>
Again it seems that the sender doesn't allow for the text property,
so I thought I could try to page load the information, but I can't
seem to reference it through intellisense. How do you get the items
in the insertitemtemplate?
Thanks in advance for all your help,
Kelly