|
Hi Friends,
I am using two method onclick of my button.
OnClientClick="ValidateDates() (Client Side Validation Method)
function ValidateDates()
{
//Get both datesvar startDate = eo_GetObject("OpenDatePicker").getSelectedDate();
var startDate = eo_GetObject("ArrivalDatePicker").getSelectedDate() ;
var endDate = eo_GetObject("DepartureDatePicker").getSelectedDate() ;
//Check if both dates are provided
if ((startDate == null) || (endDate == null))
{
alert("Please enter both Arrival and Departure dates.");
return false;
}
if (startDate.valueOf() > endDate.valueOf())
{
alert("The Arrival date must be before the Departure date.");
return false;
}
}
OnClick="addItinerary" Server Side Method
Now i am getting Alert on the Condition But my Server side Method is also being called at same time.
I want it to return when it Gets alert on Client side Validation.
Any suggestions or help would be highly appreciated
Thanks
Menon
Cheers
Menon
|
|
|
|
|
You should add return in onclick event.
For example :
onclick="return ValidateDates();"
|
|
|
|
|
Thank you very much Micheal,
It worked fine for me..
Thanks
Cheers
Menon
|
|
|
|
|
I'm really wondering who did this..
1) no matter whether it's easy or not. It solved other people's problem.
2) It's already 1:10 AM in my country but i'm still reading this forum...
but some people voted down my post... Can you please tell me what wrong with my post? Thanks.
|
|
|
|
|
Mec ... is korrect
Use return where you have called the event
P.S.
|
|
|
|
|
What s the major difference between <div> and <table></table></div>
|
|
|
|
|
The table can have the rows and columns while the DIV can't.
As the differences between table and DIV are so obvious, I think that you might not ask about that. maybe, you are asking about the differences between table layout and Div (float) layout.. Table layout Vs Div layout[^]
|
|
|
|
|
Hi,
I was trying to sort a GridView programitically but my code is throwing an System.StackOverflowException.Please have a look at the code below and reply what wrong I m doing.
protected void GridView2_Sorting(object sender, GridViewSortEventArgs e)
{
GridView2.Sort("CarrierCode", SortDirection.Descending);
}
CarrierCode is the name of a column above.
Thanks.
|
|
|
|
|
You are getting a stack overflow operation because this event occurs when the hyperlink to sort a column is clicked, but before the GridView control handles the sort operation.
GridView.Sorting Event
[^]
What is happening is your GridView2_Sorting function is executing which calls the sort method. This in turn will cause your GridView2_Sorting function to handle the sorting event thus getting stuck in a loop until the stack overflow exception is raised.
See C# GridView Sorting at http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/data/gridview.aspx[^]
for help with sorting.
Jim
|
|
|
|
|
Hi all,
I have already found the approaches to access server-side controls of a user control (e.g <asp:label> <asp:textbox> ...) on IE,
var obj = document.getElementById('uctAUserConrolID_AServerSideControlID'); //or
var obj = document.getElementById('uctAUserConrolID:AServerSideControlID'); //or
BUT, these approaches don't work on Firefox!!!
please let me know if anyone know the answer.
Thanks
Ming
|
|
|
|
|
Correct me if i'm wrong, but firefox doesn't use getElementbyId, does it?
|
|
|
|
|
Hi,
The firefox do use getElementbyId, because I tried this piece of code below to get the client-side controls within a user control , it works.
var obj = document.getElementById('AClientSideControl');
|
|
|
|
|
By the way,I use the latest version of firefox.
|
|
|
|
|
Firefox uses getElementById .
|
|
|
|
|
It would appear that indeed i am wrong...
|
|
|
|
|
You can view the HTML ViewSource in both IE and Firefox. And find out what the name of your element. then, I think you will get some idea how to get the object of your element in Javascript. If not, can you please the name of your name which is shown in the viewsource of IE and Firefox.
|
|
|
|
|
Hi Michael,
Thanks for your help, I did use the way you suggested. The HTML ViewSource for the asp:net control in both IE and Firefox are actually same:
For Firefox:
<input name="UctLogin1:txtEmail" type="text" id="UctLogin1_txtEmail" />
For IE:
<input name="UctLogin1:txtEmail" type="text" id="UctLogin1_txtEmail" style="width:200px;" />
Regards,
Ming
|
|
|
|
|
var obj = document.getElementById("UctLogin1_txtEmail"); doesn't work? You got the error or got nothing? Have you tried to debug your javascript by using Firebug?
|
|
|
|
|
No, it doesn't work with getElementById, no error shown in Firefox error console.
the result show null. but anyway, getElementsByName works ..
|
|
|
|
|
Hi Michael,
Problems solved, I use getElementsByName with its name in HTML ViewSource instead of ID, it works!
It seems like the getElimentById function still does not work compatiblely with firefox very well.
Regards,
Ming
|
|
|
|
|
okay.. great!
|
|
|
|
|
Oh dear! I just found out what I said was wrong.
getElementById function works as well!!
|
|
|
|
|
hello everybody
on my grid view i have a select command button. on gridview select click i want to pass memberID and propductID of that row and fill up modal popup with member details and product details.
any instruction will be really helpful.
thanks in advance
Sarfarj Ahmed
|
|
|
|
|
Use the button's CommandArgument and CommandName property to store the memberID and propductID as in:
<br />
<asp:Button id="btnPopUp" CssClass="btnStyle0" Text="View product" CommandArgument='<%#DataBinder.Eval(Container.DataItem, "memberID").ToString()%>' CommandName='<%#DataBinder.Eval(Container.DataItem, "propductID").ToString()%>' runat="server"><br />
</asp:Button>
Add a click evnet to the butten as in:
<br />
void btnPopUp_Click(object sender, EventArgs e)<br />
{<br />
Button btn = (Button)sender;<br />
memberID = int.Parse(btn.CommandArgument);<br />
propductID = int.Parse(btn.CommandArgument);<br />
Then use this values to get the data you need and push out an PopUp.
Remember to add the buttons clik event in the GridView's OnItemCreated.
Hope it helps
Thomas
|
|
|
|
|
Hello Friends,
When we use Servert.Transfer and set it's second parameter true then sometime it throws error
Can anybody let me know y it's happened ????????????????/
|
|
|
|