U
Ungi
Hi,
I'm new for ASP.NET and for Using C#.
I'm trying to create Web Project that have Log in form and return user ID
("UserID"), User TypeID ("fUserTypeID") ,User SecurityLevel
("UserSecurityLevel") ,User Fullname ("ShowName") from SQLdb, usind DAL.
i DrugAndDrop ObjectDataSource named/ID ObjectDataSource1 and then connect
the GridView in to it.
The ObjectDataSource1 is working with DAL (running with SP) and get 2
parameters (UserName, Password)
and return UserID and UserFullName.
the code:
<%--Start GridView--%>
<tr>
<td align="center" colspan="2">
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" DataKeyNames="UserID"
DataSourceID="ObjectDataSource1">
<Columns>
<asp:BoundField DataField="UserID" HeaderText="UserID"
InsertVisible="False" ReadOnly="True"
SortExpression="UserID" />
<asp:BoundField DataField="fUserTypeID" HeaderText="fUserTypeID"
ReadOnly="True"
SortExpression="fUserTypeID" />
<asp:BoundField DataField="UserSecurityLevel"
HeaderText="UserSecurityLevel" ReadOnly="True"
SortExpression="UserSecurityLevel" />
<asp:BoundField DataField="ShowName" HeaderText="ShowName"
ReadOnly="True" SortExpression="ShowName" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
OldValuesParameterFormatString="original_{0}"
SelectMethod="GetData"
TypeName="Dal_Class_For_AspNet_Agent.dsNWTableAdapters.AspNet_Xnet_sp_Agent_LoginTableAdapter">
<SelectParameters>
<asp:ControlParameter ControlID="inputUserName" Name="UserName"
PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="inputPassword" Name="Password"
PropertyName="Text"
Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
</td>
</tr>
<%--End GridView--%>
I manage to make it work and see the data in GrideView.
But what i like to do, is to get the return data as Recordset / Parameters
and put them into 2 separate SESSIONS, so i will be able to
print out at the top frame of the page the UserFullName and keep in SESSION
the UserID for later validation.
Can You please advice with sample code ?
I'm new for ASP.NET and for Using C#.
I'm trying to create Web Project that have Log in form and return user ID
("UserID"), User TypeID ("fUserTypeID") ,User SecurityLevel
("UserSecurityLevel") ,User Fullname ("ShowName") from SQLdb, usind DAL.
i DrugAndDrop ObjectDataSource named/ID ObjectDataSource1 and then connect
the GridView in to it.
The ObjectDataSource1 is working with DAL (running with SP) and get 2
parameters (UserName, Password)
and return UserID and UserFullName.
the code:
<%--Start GridView--%>
<tr>
<td align="center" colspan="2">
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" DataKeyNames="UserID"
DataSourceID="ObjectDataSource1">
<Columns>
<asp:BoundField DataField="UserID" HeaderText="UserID"
InsertVisible="False" ReadOnly="True"
SortExpression="UserID" />
<asp:BoundField DataField="fUserTypeID" HeaderText="fUserTypeID"
ReadOnly="True"
SortExpression="fUserTypeID" />
<asp:BoundField DataField="UserSecurityLevel"
HeaderText="UserSecurityLevel" ReadOnly="True"
SortExpression="UserSecurityLevel" />
<asp:BoundField DataField="ShowName" HeaderText="ShowName"
ReadOnly="True" SortExpression="ShowName" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
OldValuesParameterFormatString="original_{0}"
SelectMethod="GetData"
TypeName="Dal_Class_For_AspNet_Agent.dsNWTableAdapters.AspNet_Xnet_sp_Agent_LoginTableAdapter">
<SelectParameters>
<asp:ControlParameter ControlID="inputUserName" Name="UserName"
PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="inputPassword" Name="Password"
PropertyName="Text"
Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
</td>
</tr>
<%--End GridView--%>
I manage to make it work and see the data in GrideView.
But what i like to do, is to get the return data as Recordset / Parameters
and put them into 2 separate SESSIONS, so i will be able to
print out at the top frame of the page the UserFullName and keep in SESSION
the UserID for later validation.
Can You please advice with sample code ?