Anjali Khan

Anjali Khan

  • NA
  • 867
  • 224.5k

ow to display auto generate id with username with year in as

Dec 28 2017 6:53 AM
ow to display auto generate id with username with year in asp.net
How to display auto generate id like Ashu/2017/1
here 1 is auto generate id and ashu id login name .how to do this
note - i created form n submit in db aftr dispaly records in gv i want UserId - Ashu/year/1
in my table todays date column is there for generate today date .so here is showing year also so how to bind year with userid column
My procedure is
ALTER PROC [dbo].[Records_Display]
(
@UserId int = null,
@PageIndex INT = NULL,
@PageSize INT = NULL ,
@RecordCount INT OUTPUT
)
AS
BEGIN
BEGIN TRY
SET NOCOUNT ON;
BEGIN
SELECT UserId,Designation,
CONVERT(varchar(20),LetterDate,103) as LetterDate,Convert(varchar(20),ReceivedDate,103) as ReceivedDate,[Subject],
year(TodayDate) as todaydate
FROM tbl_Records
order by UserId desc
END
and i kept in gv my cloumn like
<asp:TemplateField HeaderText="UserId." SortExpression="userid" HeaderStyle-CssClass="Text-Center">
<ItemTemplate>
<a href="javascript:void();" onclick="window.open('_ViewDetails.aspx?Id=<%#DataBinder.Eval(Container.DataItem,"UserId")%>','main','scrollbars=no,fullscreen=no')">
<%# DataBinder.Eval(Container.DataItem, "userid")%></a>
<asp:Label ID="lblUserId" runat="server" Text='<%# Eval("userid") %>' Visible="false"></asp:Label>
<asp:HiddenField ID="hidtodayDate" runat="server" Value='<%# Eval("todaydate") %>' />
</ItemTemplate>
</asp:TemplateField>

Answers (4)