|
i want to validate a databound column and a template column in a datagridview.Databound colum i am displaying from database and in template colum i am allowing the user to enter a value.when user is entering value in template column i want to check whether the user enterd value is less than or equal to the value of databound column....How can i do this.........
Can anyone can help me...give some samples also........
Anu
Anu
|
|
|
|
|
anu,
In RowDataBound Event write this code
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)<br />
{<br />
if (e.Row.RowType == DataControlRowType.DataRow)<br />
{<br />
int dbValue = (int)e.Row.Cells[0].Text;<br />
TextBox txtbox = (TextBox)e.Row.FindControl("TextBox1");<br />
txtbox.Attributes.Add("onblur", "validateValue('"+ dbValue +"','"+ (int)txtbox.Text +"');");<br />
}<br />
}<br />
add this javascript code in head section
function validateValue(dbvalue, enteredValue)<br />
{<br />
<br />
if(enteredValue < dbvalue)<br />
{<br />
alert("please enter the value equal or greate of column1 ");<br />
}<br />
}
hope this will help, as per the ur requirement fire this javascript validation related event.
regards
GV Ramana
|
|
|
|
|
How i can assignto gridview colum what i typed in template colum textbox
|
|
|
|
|
How can I perform uploading files to the webserver without refreshing whole page?
AJAX UpdatePanel and standard FileUpload do not work together...
|
|
|
|
|
you can read this article : http://www.codeproject.com/useritems/simpleajaxupload.asp
|
|
|
|
|
I didn't mean that. The question was how to organize asynchronous upload of the file.
|
|
|
|
|
|
Have you got any similar information that doesn't need knowledge of PHP?
|
|
|
|
|
sir i want navigate on other page when we click buttonfield column in the gridview.
thanks
|
|
|
|
|
write a javascript function & call that method onclick of that button.
common url for all buttons of grid ? or for each button different url ?
regards
GV Ramana
|
|
|
|
|
Hi,
I am Retrieving the binary image from sql database on web page. For that I have written following code in vb.net
Dim stream As MemoryStream = New MemoryStream()
Dim image As Byte()
Dim bitmap As Bitmap
Dim username As String
username = Session("memberuser")
con = New SqlConnection("server=ABC-0A55D6C3C90;database=satphere;uid=sa;pwd=")
Try
con.Open()
cmd = New SqlCommand("select photo from ViewProfile where userid = @userid", con)
cmd.Parameters.AddWithValue("@userid", username)
>>>>>>>>> image = CByte(cmd.ExecuteScalar())
stream.Write(image, 0, image.Length)
bitmap = New Bitmap(stream)
Response.ContentType = "image/gif"
'bitmap.Save(Response.OutputStream, ImageFormat.Gif)
bitmap.Save(Server.MapPath("TempImage/aa.gif"))
Image1.ImageUrl = "TempImage/aa.gif"
Catch ex As Exception
con.Close()
Stream.Close()
End Try
I am getting the error as
Value of type 'Byte' cannot be converted to '1-dimensional array of Byte'
line is mentioned by >>>>>>
C#.net code for same is working fine--------------as follwos
MemoryStream stream = new MemoryStream ();
SqlConnection connection = new SqlConnection(@"server=ABC-0A55D6C3C90;database=Test;uid=sa;pwd=");
try
{
connection.Open ();
SqlCommand command = new SqlCommand("select Picture from Image", connection);
byte[] image = (byte[])command.ExecuteScalar();
stream.Write(image, 0, image.Length);
Bitmap bitmap = new Bitmap(stream);
Response.ContentType = "image/gif";
bitmap.Save(Response.OutputStream, ImageFormat.Gif);
//bitmap.Save(Server.MapPath("TempImage/aa.gif"));
}
finally
{
connection.Close ();
stream.Close ();
}
can any one give me solution for this
Thanks to all
|
|
|
|
|
try this code
image = CType(cmd.ExecuteScalar(),Byte())
Best Regard
Pathan
---------------------------------------------------
|
|
|
|
|
My knowledge of VB is rubbish, but I would say the problem is as follows:
cmd.ExecuteScalar() returns object, which is supposed to be array of bytes,
but your call CByte(cmd.ExecuteScalar()) is trying to convert this object into object of type byte (not array of bytes) and that causes your error.
Unfortunately, I don't know correct syntax in VB for casting object into array, I hope you do (otherwise you have to google it )
Pilo
|
|
|
|
|
Hi
In my application i need to save IP address of the system who accessing my
application or any user visit my site.
How can i get IpAddress of that system.
Thanks.
Rahul
|
|
|
|
|
Request.UserHostAddress
Best Regard
Pathan
---------------------------------------------------
|
|
|
|
|
|
Request.ServerVariables["REMOTE_ADDR"]
|
|
|
|
|
ASP.NET Ajax doesn't support in .NET 1.1.
So, you have to choose other Ajax frameworks.. there are a lot of free ajax framework for ASP.NET 1.1. Check-out the link below if you interest..
Ajax Frameworks and Others.
If you are good at Javascript, you can probably use Prototype Javascript Library.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
I have data I want to filter it according to 3 caracters. the problem is that it is in a details view control.
BiG RaLpH
|
|
|
|
|
details view control or data grid control ? From where does your filter criteria come from.
|
|
|
|
|
In the insertitemtemplate in the details view.
in the dropdownlist I can show the items all I need is to filter these items to a 3 char input from the user.
BiG RaLpH
|
|
|
|
|
sir i had applied javasript validattion in our application if client disable javascript on his syatem then all validation are failed .
i want to know how we enable javascript at runtime in asp.net application
thanks
|
|
|
|
|
RegisterClientScriptBlock("validationscript", "function......");
Button1.Attributes.Add("onclick", "validate");
|
|
|
|
|
puspendra napit wrote: lient disable javascript on his syatem
Your client disable Javascript on his/her browser?
It is not possible to change the client's setting from web application. It is for security reason. So, what all you can do is that check whether the Javascript is enabled or disabled for the user's browsers. If it is disabled, you should check the validation from code-behind.
Since Ajax web application are so popular day by day, I don't care about those users who are disable the Javascript in my project. But Yes, the requirement may be varied from project to project....
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
i need to how to disable/Enable Javascript at runtime in asp.net
Thanks in Advance
|
|
|
|