|
Hi there,
i want to validate user input in the text box which take a document number to check in database, the input must be in this format SSD-SGZZ99-A0101 or SSD-SGZZ99-AE0101 [(3alpha)(-)(4alpha 2numeric)(-)(1 or 2alpha 4numeric)] Total 16 or 17 character, now can some one send me a sample to validate this requirement.... i also want to disable the button till this validation is not completed, once the user keyin the right number the button should be enable.
any suggestion will be appreciated.
i need the sample code to use the custom validator control.
Regards
Ybasha
|
|
|
|
|
i need the script to validate some thing like this
function validateDate()
{
var ptext = document.getElementById("TBDocNum");
if(ptext = ("(SSD)|(SSA)(-)(a-zA-Z0-9){4,2}(-)(a-zA-Z0-9){6,2})");
}
but it not correct any help on this???
|
|
|
|
|
or can some one give me a simple to break this string
SSD-SGZZ99-A0101 --> 16 character or
SSD-SGZZ99-AE0101 --> 17 character
to added in ValidationExpression="(SSD)|(SSA)(-)(a-zA-Z0-9){4,2}(-)(a-zA-Z0-9){6,2})" for regular expression validator.
regards
Ybasha
|
|
|
|
|
Hi there,
I already got the solution.
regards
ybasha
|
|
|
|
|
A Hard question.
I Have page in aspx, but in different page i would not to redirect, but to read entire content in html format into string?
It is like Response.Redirect, it executes, and convert to html then redirect. But i want to do exactly same, expect redirect, but to string.
I want to do this, because that html would be sent as an email.
Thanks you in advance.
|
|
|
|
|
If you need to grab the HTML source that is returned from a web page, then you use the WebRequest[^] Class to request the page and that will return a WebResponse[^]
WebRequest request = WebRequest.Create("http://www.tempuri.org");
WebResponse response = request.GetResponse();
Stream responseStream = response.GetResponseStream();
response.Close();
|
|
|
|
|
Thanks you very much. That's what i needed.
|
|
|
|
|
I try to display data of all employees weekly report. I am using nested gridview, where i need to pass Userid from parent to child gridview so that it display the data according to Userid.
Can some help me on this to pass the values?
Here is my code:
Protected Sub btnook_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOOk.Click
Dim strsql As String = ""
Dim strsdate As String = String.Format("{0 }", TextBox1.Text)
Dim stredate As String = String.Format("{0 }", TextBox2.Text)
parentgrid(strsdate, stredate)
MsgBox("after function called")
End Sub
Public Function parentgrid(ByVal stsdate As String, ByVal stedate As String) As DataSet
Dim strsdate As String = String.Format("{0 }", stsdate)
Dim stredate As String = String.Format("{0 }", stedate)
'Dim struser As String = user
Try
strsql = "SELECT b.Userid, sum(format(b.Time2 - a.Time1, ""h.mm"")) AS TotalTime FROM " _
& "(select Userid, num,TimeStamp as time2, pdate from PunchClock " _
& "where InOut='IN' AND PDate >= #" & strsdate & "# And PDate <= #" & stredate & "# " _
& " ORDER BY timestamp) AS b INNER JOIN " _
& "(select Userid, num,TimeStamp as time1, pdate from PunchClock " _
& "where InOut='OUT' AND PDate >= #" & strsdate & "# And PDate <= #" & stredate & "# " _
& "ORDER BY timestamp) AS a ON (b.num = a.num) AND (b.pdate=a.pdate) and (b.Userid=a.Userid) group by b.userid;"
'Opening the database
cmd.CommandType = CommandType.Text
cmd.CommandText = strsql
cmd.Connection = con
con.Open()
MsgBox("Main" & strsql)
objReader = cmd.ExecuteReader
MsgBox("Out2:" & strsql)
da = New OleDbDataAdapter(strsql, con)
ds = New DataSet("Userdetail")
dt = ds.Tables.Add(strsql)
da.Fill(ds, strsql)
con.Close()
ParentGridView.DataSource = ds
ParentGridView.DataBind()
Catch ex As Exception
MsgBox("oops: " & ex.Message, MsgBoxStyle.OkOnly, "Error")
con.Close()
End Try
Return ds
End Function
Protected Sub ParentGridView_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles ParentGridView.RowDataBound
Dim strsdate As String = String.Format("{0 }", TextBox1.Text)
Dim stredate As String = String.Format("{0 }", TextBox2.Text)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim gv As GridView
gv = e.Row.FindControl("ChildGridView")
Dim struser As String
struser = e.Row.FindControl("EmpName").ToString()
Try
strsql = "SELECT b.Userid, Format([b.PDate],""m/d/yyyy"") AS PDate, b.Time2, " _
& "b.InOut as TIN, a.Time1, a.InOut as TOUT, format(b.Time2 - a.Time1, ""h.mm"") AS TotalTime FROM " _
& "(select Userid, PDate, num, TimeStamp as time2, InOut from PunchClock " _
& "where Userid='" & struser & "' AND InOut='IN' AND PDate >= #" & strsdate & "# And PDate <= #" & stredate & "# " _
& "ORDER BY PDate, timestamp) AS b INNER JOIN " _
& "(select Userid, PDate, num, TimeStamp as time1, InOut from PunchClock " _
& "where Userid='" & struser & "' AND InOut='OUT' AND PDate >= #" & strsdate & "# And PDate <= #" & stredate & "# " _
& "ORDER BY PDate, timestamp) AS a ON (b.num = a.num) AND (b.pdate=a.pdate) " _
& "group by b.userid, b.PDate, b.time2, a.time1, a.InOut, b.InOut " _
& "ORDER BY b.PDate, b.time2, a.time1;"
'Opening the database
cmd.CommandType = CommandType.Text
cmd.CommandText = strsql
cmd.Connection = con
con.Open()
MsgBox("Parent" & strsql)
objReader = cmd.ExecuteReader
MsgBox("Out2:" & strsql)
da = New OleDbDataAdapter(strsql, con)
ds = New DataSet("Fulldeatils")
dt = ds.Tables.Add(strsql)
da.Fill(ds, strsql)
con.Close()
gv.DataSource = ds
gv.DataBind()
Catch ex As Exception
MsgBox("oops: " & ex.Message, MsgBoxStyle.OkOnly, "Error")
con.Close()
End Try
End If
End Sub
HTML:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>
<title>Untitled Page
<asp:label id="Label8" runat="server" text="Start Date:" width="104px">
<asp:textbox id="TextBox1" runat="server" width="112px">
<asp:imagebutton id="ImageButton1" runat="server" imageurl="~/Images/calendar.jpg"
="" width="24px"> <asp:calendar id="Calendar1" runat="server" height="120px" visible="False"
="" width="176px">
<todaydaystyle backcolor="Transparent" forecolor="Red">
<weekenddaystyle backcolor="#FFC0C0" forecolor="#804040">
<asp:label id="Label9" runat="server" text="End Date:" width="104px">
<asp:textbox id="TextBox2" runat="server" width="112px">
<asp:imagebutton id="ImageButton2" runat="server" imageurl="~/Images/calendar.jpg"
="" width="24px">
<asp:calendar id="Calendar2" runat="server" height="120px" visible="False" width="176px">
<todaydaystyle backcolor="Transparent" forecolor="Red">
<weekenddaystyle backcolor="#FFC0C0" forecolor="#804040">
<asp:button id="btnOOk" runat="server" font-bold="True" forecolor="Black" text="OK"
="" width="56px">
<asp:button id="Button3" runat="server" font-bold="True" forecolor="Black" text="Cancel">
<asp:button id="Button1" runat="server" text="Button">
<asp:gridview id="ParentGridView" runat="server" style="z-index: 100; left: 27px; position: absolute;
top: 509px" autogeneratecolumns="False" backcolor="White" bordercolor="#336666" borderstyle="Double"
="" borderwidth="3px" cellpadding="3" gridlines="Horizontal" allowpaging="False" datakeynames="Userid" onrowdatabound="ParentGridView_rowDataBound">
<footerstyle backcolor="White" forecolor="#333333">
<rowstyle backcolor="White" forecolor="#333333">
<selectedrowstyle backcolor="#339966" font-bold="True" forecolor="White">
<pagerstyle backcolor="#336666" forecolor="White" horizontalalign="Center">
<headerstyle backcolor="#336666" font-bold="True" forecolor="White">
<columns>
<asp:templatefield headertext="Employee Name">
<itemtemplate>
<asp:label id="EmpName" runat="Server" text="<%# Bind("Userid") %>">
<asp:boundfield datafield="TotalTime" dataformatstring="{0:n}" headertext="TotalTime">
<asp:templatefield headertext="Weekly Report" insertvisible="False">
<itemtemplate>
<asp:gridview id="ChildGridView" runat="server" autogeneratecolumns="False">
<columns>
<asp:boundfield datafield="PDate" headertext="Date" htmlencode="False">
<asp:boundfield datafield="Time2" dataformatstring="{0:t}" headertext="TimeIn" htmlencode="False">
<asp:boundfield datafield="TIN" headertext="In" htmlencode="False">
<asp:boundfield datafield="Time1" dataformatstring="{0:t}" headertext="TimeOUT" htmlencode="False">
<asp:templatefield headertext="TOUT">
<itemtemplate>
<asp:label id="Label2" runat="server" text="<%# Bind("TOUT", "{0:t}") %>">
<footertemplate>
<asp:label id="Label7" text="Total:" font-bold="True" width="50" borderstyle="Solid"
="" borderwidth="0" style="padding:2px; margin-top:5px" runat="Server">
<asp:label id="Label4" text="OverTime:" font-bold="True" width="50" borderstyle="Solid"
="" borderwidth="0" style="padding:2px; margin-top:5px" runat="Server">
<asp:templatefield headertext="TotalTime">
<itemtemplate>
<asp:label id="Label3" text="<%# FormatNumber(Get_Time(Eval("TotalTime"))) %>" runat="Server">
<footertemplate>
<asp:label id="TotalTime" text="<%# FormatNumber(Get_Total_Time()) %>" width="80" runat="Server"
="" font-bold="True" borderstyle="Solid" borderwidth="1" bordercolor="#C0C0C0" style="padding:2px; margin-top:5px">
<asp:label id="Label5" text="<%# FormatNumber(Get_Over_Time()) %>" runat="Server">
<itemstyle horizontalalign="Right">
<footerstyle borderwidth="0px" font-bold="True" horizontalalign="Right">
Shrihit
|
|
|
|
|
No one will probably help until you put the code within <pre> </pre> tags.
|
|
|
|
|
type priortity status
---------------------------------------
bug low postponed
bug low yy
bug medium xx
bug1 low xx
bug1 high postponed
---------------------------------------
The above table's data is required in following format as grouped data and needs to be displayed in a datatable or gridview.
Can anyone give me code.
---------------------------------------
low postponed
bug yy
---------------------------------
medium xx
----------------------------------------
low xx
bug1
--------------------------------
high postponed
sanjay kumar samantaray
|
|
|
|
|
|
Hi,
I'm using window.showModalDialog to open a modal dialog.
The modal dialog needs get the current user's name. To do this i use
Membership.GetUser().UserName;
But when the dialog is posted back Membership.GetUser() return null
and i can't get the user's name.
Does anybody have a clue how to get the user's name?
Thanks.
|
|
|
|
|
I don't know how with the post back. Bat you could try Session or Cookie
|
|
|
|
|
|
Hello,
I'm having some problems to enable radiobutton in ie7 by javascript. I was googling all day, but I only found one post with the same problem I have. I paste it here to explain what my problem is:
Hi All,
I've come across the problem of not being able to re-enable a radio
button with javascript if its initial state has been disabled in the
Page_Load() method of the code behind.
Might i add that it behaves fine in Firefox, but IE is unable to
re-enable the radio button. IE is fine if the radio button starts in an
enabled state.
Version of IE i'm using is 6, and i have also tried with IE7 and got
the same result.
Is this a bug specific to IE ?
This post has only one answer, which is:
Hi There
function enable()
{
var controls = document.getElementsByTagName("input");
NumElements = controls.length;
for (i=0;i<NumElements;i++)
{
if(controls[i].name=="rdEnable")
{
controls[i].setAttribute("disabled" , false);
ParentSpanControl = controls[i].parentElement;
ParentSpanControl.setAttribute("disabled" , false); break;
}
}
return false;
}
Explanation:
============
A DotNet Radio Button Control will result in creation of the following
three controls
1.Span Control
2.Input Type=Radio
3.Label
So using javascript , do identify all the controls that radio button is
rendered to and set their disabled propery to false;
Please find the above code which does the same
I tried to enable by javascript the input (this works in Firefox, Opera and Netscape, but not in IE), the span, and the label, but I have not get the solution. Here I put the code I try with:
function habilitarPr2IDI(){<br />
<br />
var controls = document.getElementsByTagName("input");<br />
NumElements = controls.length;<br />
<br />
for (i=0;i<NumElements;i++)<br />
{<br />
if(controls[i].name=="InputName")<br />
{<br />
controls[i].disabled = false;<br />
ParentSpanControl = controls[i].parentNode;<br />
label = ParentSpanControl.lastChild;<br />
ParentSpanControl.disabled = false;<br />
label.disabled = false;<br />
}<br />
}<br />
}
Can anyone help me? Thanks a lot.
|
|
|
|
|
Check the HTML source of the page rendered when the radio buttons are disabled. My guess is that the radio buttons aren't rendered with just a disabled atteribute but in another way all together for IE. I've never actually looked at it myself, but it's the first guess in my head.
|
|
|
|
|
This is the HTML source of a disabled radio button:
<td><span disabled="disabled"><input id="radioId" type="radio" name="radioName" value="Text" disabled="disabled" /><label for="radioId">Text</label></span></td>
and this is the HTML of a non-disabled radio button:
<td><input id="radioId" type="radio" name="radioName" value="Text" /><label for="radioId">Text</label></td>
I think the problem is in the tag span. I try to disabled the span too, but didn´t work in IE.
|
|
|
|
|
I recently rolled out a change where I changed the old javascript menu (that only worked in IE) to a new menu using the ASP.NET menu control (so it works in other browsers). I have one user with Windows XP and IE6 where the flyouts on the menu appear at the top of the page rather than next to the menu control like it does on every other computer/browser combination I tested on (and that other users are using). I installed all the patches for IE6 from windows update, but I can't move to IE7 since the company has other internal apps that don't work on IE7. This same computer can do another application I built with the ASP.net menu control perfectly.
Any idea why this happens? I might just go with a pure CSS menu, but its hard to beat the simplicity of the menu control.
|
|
|
|
|
In my Gridview rowUpdating event, am not able to retrieve e.NewValues.
e.NewValues and e.OldValues everything returns empty.
Can you please help?
Thanks.
|
|
|
|
|
Are they by any chance keys? I run into this problem once:
"This property does not contain the key fields. To access the key fields, use the Keys property. You can also access the original field values by using the OldValues property."
msdn[^]
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
e.Keys.Count , e.NewValues,e.OldValues, even e.RowIndex everything returns 0.
What I want to do is, store the grid in the dataset and then when the row is edited,
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) is called.
now after all rows are updated, the updated grid will be stored in the dataset and finally everything will be pushed into db on Save button click.
Can you please help me how to do this?
Thanks
|
|
|
|
|
Hi there,
it worked fine. For almost decades now:
I create a C# Webproject and set the project options to Debugging->Always
use IE = false (translated from german). When starting to debug the project
it fires up with Firefox since this is my standard browser.
Since a couple of days it does not work this way anymore. Eventhough Firefox
is still my standard browser (yes, I checked tripple), IE will fire up when
pressing F5.
Any ideas on how to solve this?
Greetings from Berlin, Matthias
/matthias
I love deadlines. I like the whooshing sound they make as they fly by. [Douglas Adams]
|
|
|
|
|
right click the web project and select Browser With option
|
|
|
|
|
thanks a lot. that helped.
/matthias
I love deadlines. I like the whooshing sound they make as they fly by. [Douglas Adams]
|
|
|
|
|
Hi,
if i make a static method, that gets Data from my DB, will the method be threadsafe? I mean while one user requests some data and the method is running, can another user that wants to do the same, read/write the variables in this static method?
I know it's a beginners question, i searched a lot but i didn't find an answer.
Thanks for helping me in advance.
|
|
|
|
|