Hi
I am using VS2003. I had a DataGrid in my form. Inside Datagrid I had a Textbox.
I had put the validations using Required Field Validator for that textbox with EDIT, UPDATE & CANCEL buttons
If i click EDIT button, it is showing the JAVASCRIPT error that Semicolumn expected.
In the Local server it is working fine, but after deployment its giving the Error.
How to remove the error.. Help me...
Regards,
Jai Shankar
Post your datagrid code and any javascript code you have....
Sri
Thanks for the reply.
I had created a TemplateColumn inside DataGrid.
In that Template colums i had put one TextBox & a Required Field Validator ([0-9]+\.?[0-9]*) for the Control TextBox for accepting only float values.
While running in the local server with the JAVA SCRIPT ERROR, it is working fine. But after deploying, It is showing the JAVA SCRIPT error that ( ; ) expected.
If i delete the Required Field Validator, ERROR is not showing. Thats the problem...
Please let me know if you have any queries..
Thanks & Regards
Do this, once you go to the page where this code is check the source of the page, all the validators will be conveted to java script functions when the browser loads the page, if you check the java script function you may find the problem,
Sri
Thanks for the reply..
I found the code for the Validation control in source code..
The first code was happened before the click event of EDIT button of Datagrid and without error.
The second code was happened when i click the EDIT button of Datagrid and with error.
<span id="DataGrid1__ctl2_RegularExpressionValidator1" controltovalidate="DataGrid1__ctl2_dgtxttime" errormessage="Enter hours" evaluationfunction="RegularExpressionValidatorEvaluate IsValid" validationexpression="[0-9]+\.?[0-9]*" style="color:Red;width:13px;visibility:hidden;">*</span>
<span id="DataGrid1__ctl2_RegularExpressionValidator1" controltovalidate="DataGrid1__ctl2_dgtxttime" errormessage="Enter hours" isvalid="False" evaluationfunction="RegularExpressionValidatorEvaluateIsValid" validationexpression="[0-9]+\.?[0-9]*" style="color:Red;width:13px;">*</span>
i am not able to find out the error..
Please help me
Regards,
Jai Shankar
I think there is something wrong with the validation expression you are using,
Here is what I am using for letting the users enter double values
validationexpression="^(-)?\d+(\.\d\d)?$"
Here is what I am getting when I page loads
ctl02_DataGridCtrl_ctl12_RegEx4.validationexpression = "^(-)?\\d+(\\.\\d\\d)?$";
My expression allows negative values as well,
check the following link for more numeric expression
http://regexlib.com/DisplayPatterns.aspx?categoryId=3&cattabindex=3
Hope this helps
Sri
Thanks for the Reply.
I used ^[0-9]+[.]?[0-9]*$ for allowing only float values.
Its working fine but after deploying its giving JavaScript Error that ; expected.
Why it is happening after deploying...
Please help me.....
Regards,
Jai Shankar
Hi:
Could you provide the link to your web site or just paste the client side HTML markups here for us to reproduce this problem?
Thanks
private void bind(){string connstr = ConfigurationSettings.AppSettings["connstr"];SqlConnection cn =new SqlConnection(connstr);cn.Open();if(Session["order"]!=null){SqlDataAdapter da=new SqlDataAdapter(Session["order"].ToString(),cn);DataSet ds=new DataSet();int count = da.Fill(ds);DataGrid1.DataSource=ds;DataGrid1.DataBind();da.Dispose();cn.Close();ds.Dispose();cn.Dispose();}else {SqlCommand com =new SqlCommand("select EDD_ID, convert(varchar,edd_date,101) edd_date, proj_name,edd_activity_type,edd_remarks,edd_workhours from ct_tm_employeedailydetails,ct_tm_projectmaster where edd_emp_ID='"+ Session["EMPID"].ToString().Trim() +"'and edd_proj_id=proj_id and EDD_Freeze is null order by edd_date desc",cn);SqlDataAdapter dad=new SqlDataAdapter(com);DataSet ds=new DataSet();dad.Fill(ds);DataGrid1.DataSource=ds;DataGrid1.DataBind();ds.Dispose();dad.Dispose();com.Dispose();cn.Close();cn.Dispose();}}private void DataGrid1_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e){//btnfilter.Enabled=false;//btnsubmit.Enabled=false;DataGrid1.EditItemIndex = e.Item.ItemIndex;int d = e.Item.ItemIndex;bind1(d);}private void bind1(int i){string connstr = ConfigurationSettings.AppSettings["connstr"];SqlConnection cn =new SqlConnection(connstr);cn.Open();if(Session["order"]!=null){SqlDataAdapter da=new SqlDataAdapter(Session["order"].ToString(),cn);DataSet ds=new DataSet();int count = da.Fill(ds);if(count!=0){string edid = ds.Tables[0].Rows[i][0].ToString();strproname = ds.Tables[0].Rows[i][2].ToString();stractivity = ds.Tables[0].Rows[i][3].ToString();}DataGrid1.DataSource=ds;DataGrid1.DataBind();da.Dispose();ds.Dispose();}else {SqlDataAdapter da=new SqlDataAdapter("select Edd_ID, convert(varchar,edd_date,101) edd_date, proj_name,edd_activity_type,edd_remarks,edd_workhours from ct_tm_employeedailydetails,ct_tm_projectmaster where edd_emp_ID='"+ Session["EMPID"].ToString().Trim() +"'and edd_proj_id=proj_id and EDD_Freeze is null order by edd_date desc",cn);DataSet ds=new DataSet();int count = da.Fill(ds);if(count!=0){string edid = ds.Tables[0].Rows[i][0].ToString();strproname = ds.Tables[0].Rows[i][2].ToString();stractivity = ds.Tables[0].Rows[i][3].ToString();}DataGrid1.DataSource=ds;DataGrid1.DataBind();txtdate.Text="";txttime.Text="";txtremarks.Text="";ds.Dispose();da.Dispose();}cn.Close();cn.Dispose();}private void DataGrid1_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e){btnfilter.Enabled=true;btnsubmit.Enabled=true;DataGrid1.EditItemIndex = -1;bind();//bindfilter();}private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e){if(e.Item.ItemType == ListItemType.EditItem){string connstr = ConfigurationSettings.AppSettings["connstr"];SqlConnection cn =new SqlConnection(connstr);cn.Open();SqlCommand com =new SqlCommand("Select distinct Proj_Name from CT_TM_ProjectMaster,CT_TM_AllocationMaster where Proj_ID=Alloc_Proj_ID and Alloc_Emp_ID = '"+Session["EMPID"].ToString().Trim()+"' ",cn);SqlDataReader dr =com.ExecuteReader();while(dr.Read()){DropDownList droplst=new DropDownList();droplst = (DropDownList) e.Item.FindControl("dgdroppname");droplst.Items.Add(dr[0].ToString().Trim());}DropDownList droplst1=new DropDownList();droplst1 = (DropDownList) e.Item.FindControl("dgdroppname");droplst1.SelectedValue=strproname.ToString();dgpname = droplst1.SelectedValue.ToString();dr.Close();com.Dispose();DropDownList dropactivity=new DropDownList();dropactivity = (DropDownList) e.Item.FindControl("dgdropacttype");dropactivity.SelectedValue=stractivity.ToString();cn.Close();cn.Dispose();}}private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)Have you understood whats the problem is...
Hijaishankar,
What i understood from ur post is urs javascript is working fone but they are alerts/error message in online. Please make me correct if understood wrongly.
If its true then u have to do fiollowing things..
1) Create a folder in ur domain root ( online) >> aspnet_client\system_web\1_1_4322 ( ususally last one is version no ) i have this one and this one aspnet_client\system_web\2_0_50727
2) in that folder put the javascript by name "WebUIValidation.js" everything will work fine.
I have uploaded js to this path for download http://www.4shared.com/dir/4603336/ecb60acc/Valdation_Online.html. I dont know how to add files/ folders to this forums. If some one could teach me that will be nice.
Thanks a lot. I got the answer.
If i have any doubts, i will sure ask you...
Thank you so much
No comments:
Post a Comment