|
Well said Guffa.
SSK.
Anyone who says sunshine brings happiness has never danced in the rain.
|
|
|
|
|
Hello,
I have 2 dropdownlist A and B
When I select from A, I get the B list according to A selection.
I done it implementing callback process.
This work fine.
In addition, I have a button in my form that after clicking it , I fill a gridview according to A nd B selections.
The problem is that after clicking on the button, the B dropdownlist is empty, the postback action empty my B dropdownlist.
How can I fix this problem.
Here is my code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim dt As DataTable = GetCategory()
Dim dv As DataView = dt.DefaultView
cmbCategory.DataSource = dv
cmbCategory.DataTextField = "PROFCAT"
cmbCategory.DataValueField = "PROFID"
cmbCategory.DataBind()
cmbCategory.Attributes.Add("onchange", "GetChildren(this.options[this.selectedIndex].value,'ddl');")
Dim callBack As String = Page.ClientScript.GetCallbackEventReference(Me, "arg", "ClientCallback", "context", "ClientCallbackError", False)
Dim clientFunction As String = "function GetChildren(arg,context){ " + callBack + "; }"
Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "GetChildren", clientFunction, True)
End If
End Sub
Public Sub RaiseCallbackEvent(ByVal eventArgument As String) Implements System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent
Dim dt As DataTable = GetSubCategory(eventArgument)
Dim dv As DataView = dt.DefaultView
Dim sb As New StringBuilder()
For i As Integer = 0 To dv.Count - 1
sb.Append(dv(i)("SUBPROFID"))
sb.Append("^")
sb.Append(dv(i)("SUBPROFCAT"))
sb.Append("|")
Next
_callbackArg = sb.ToString
End Sub
Public Function GetCallbackResult() As String Implements System.Web.UI.ICallbackEventHandler.GetCallbackResult
Return _callbackArg
End Function
Private Function GetCategory() As DataTable
Dim dt As DataTable = DirectCast(Cache("Category"), DataTable)
If dt Is Nothing Then
Dim connection As New OleDbConnection(connectionstring)
Dim command As New OleDbCommand("SELECT PROFID, PROFCAT FROM PROFESSION ORDER BY PROFCAT", connection)
command.CommandType = CommandType.Text
Dim da As New OleDbDataAdapter(command)
dt = New DataTable
Try
connection.Open()
da.Fill(dt)
Cache.Insert("Category", dt, Nothing, DateTime.Now.AddHours(6), TimeSpan.Zero)
Finally
connection.Dispose()
command.Dispose()
da.Dispose()
End Try
End If
Return dt
End Function
Private Function GetSubCategory(ByVal eventargument As String) As DataTable
Dim connection As New OleDbConnection(connectionstring)
Dim command As New OleDbCommand("SELECT SUBPROFID, SUBPROFCAT FROM SUBPROFESSION WHERE PROFID=" & eventargument, connection)
command.CommandType = CommandType.Text
Dim da As New OleDbDataAdapter(command)
Dim dt As New DataTable
Try
connection.Open()
da.Fill(dt)
Finally
connection.Dispose()
command.Dispose()
da.Dispose()
End Try
Return dt
End Function
Protected Sub cmdSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdSearch.Click
'When clicking this button, postback occur and B dropDownList is beeing empty
end Sub
'''''''''''''''''''''''''
// <!CDATA[
function ClientCallback(result, context){
var subcategory = document.forms[0].elements['<%=CmbSubCategory.UniqueID%>'];
if (!subcategory){
return;
}
subcategory.length = 0;
if (!result){
return;
}
var rows = result.split('|');
var option = document.createElement("OPTION");
option.innerHTML = "בחר...";
option.value= "-1";
option.style.color = 'blue';
subcategory.appendChild(option);
option= document.createElement("OPTION");
option.innerHTML = "הכל";
option.value= "0";
option.style.color= "purple";
subcategory.appendChild(option);
for (var i = 0; i < rows.length-1; ++i){
var values = rows[i].split('^');
var option = document.createElement("OPTION");
option.value = values[0];
option.innerHTML = values[1];
subcategory.appendChild(option);
}
}
function ClientCallbackError(result, context)
{
alert(result);
}
// ]]>
Thank you for help
Shay Noy
|
|
|
|
|
You should only post the code where you suspect the problem is. Not the whole thing.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Thank you!
I though that the code may be useful for other users who want to use callback.
So, here is my problem:
I have 2 dropdownlist A and B
When I select from A, I get the B list according to A selection.
I done it implementing callback process.
This work fine.
In addition, I have a button in my form that after clicking it , I fill a gridview according to A nd B selections.
The problem is that after clicking on the button, the B dropdownlist is empty, the postback action empty my B dropdownlist.
How can I fix this problem.
Shay Noy
|
|
|
|
|
i want to detect slang word from sentence by vb script and this slang word will be findout from access database how is it possible?
Please help me.
|
|
|
|
|
herodhk wrote: access database how is it possible?
Start by creating an Access database that is a dictionary of slang words...
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
i have already a slang word Access dictionary. Ok i clear my problem with a one example.
example is ....
the sentence is "you are a dogboy." ...
here "dog" will be the slang word and how can i detect dog word form this sentence...
please help me
|
|
|
|
|
i am having one gridview in my application where i am displaying one linkbutton column in it. By clicking on the link some xxxx.wav will be downloaded and directly played in the media player.
Code:
<ItemTemplate>
<a href='feedback/<%#Eval("Filename")%>' target="_self"><%# Eval("FeedbackTitle") %></a>
</ItemTemplate>
what i want is, to show some xxx.gif image to the user at the time of downloading it will be useful for larger files.
if anybody has a solution for this please do let me know.
with warm regards
sunilwise
|
|
|
|
|
I upload a site but it display an error "Object reference not set to an instance of an object".In my class
it display an error in these lines
Dim st As String = ConfigurationSettings.AppSettings("str")
Line 9: Public con As New MySqlConnection(st)
How can i solve this problem.I am using mysql dataconnection.
|
|
|
|
|
I'd guess that your problem is that the config file is not set up properly, and your code doesn't check for nulls.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi all,
there are two textboxes in my page. FromDate and ToDate. dates are selected from popup calender and displayed in respective textboxes. when I click on a button, have to satisfy the following conditions.It is working with MM/dd/yyyy format.. but when I change the format to dd/mm/yyyy getting error..
1. Difference between FromDate and ToDate sholud not greater than 31.
2. FromDate should be less than ToDate.
3. ToDate is not greater than current date.
below is the code I had written: This code is working fine with MM/dd/yyyy date format.. but when I give the date in dd/mm/yyyy getting error.
TimeSpan tsDaysDifference = Convert.ToDateTime(txtToDate.Text).Subtract(Convert.ToDateTime(txtFromDate.Text));
if (tsDaysDifference.Days > ConInterfaceManagerCommon.DATE_RANGE)
{
StringBuilder strbldrErrorScript = new StringBuilder("");
strbldrErrorScript.Append("alert('Difference between from and to dates should not morethan 31')");
strbldrErrorScript.Append("");
ClientScript.RegisterClientScriptBlock(this.GetType(), "Error", strbldrErrorScript.ToString());
return false;
}
else
if (tsDaysDifference.Days < ConInterfaceManagerCommon.DATE_MINIMUM)
{
StringBuilder strbldrErrorScript = new StringBuilder("");
strbldrErrorScript.Append("alert('From date should be lessthan todate')");
strbldrErrorScript.Append("");
ClientScript.RegisterClientScriptBlock(this.GetType(), "Error", strbldrErrorScript.ToString());
return false;
}
else
if (Convert.ToDateTime(txtToDate.Text) > DateTime.Now)
{
StringBuilder strbldrErrorScript = new StringBuilder("");
strbldrErrorScript.Append("alert('To date should be lessthan current date.')");
strbldrErrorScript.Append("");
ClientScript.RegisterClientScriptBlock(this.GetType(), "Error", strbldrErrorScript.ToString());
return false;
}
else
return true;
Can anyone help how to find the date difference in dd/mm/yyyy format on serverside?
Many Thanks
|
|
|
|
|
When converting to a datetime object, you need to specify the format of the date if you are giving it a format other than the default for the server. Your server is expecting mm/dd/yyyy, so if you want to specify a different date format, you will need to tell the ToDateTime function what format you are providing the data in.
|
|
|
|
|
i want the asci code of an upward arrow
|
|
|
|
|
You can try this.
&uarr
Thanks,
Sun Rays
To get something you must have to try once.
My Articles
|
|
|
|
|
hi
visit this link
http://www.modport.co.uk/index.php?showtopic=2045
Jintal Patel
|
|
|
|
|
i created cookie using javascript in page when i go to ather page i want manage it using asp.net i can read the cookie but i cant update it value when i update it value its create ather cookie thnx hope u can hekp me
|
|
|
|
|
Can anybody tell where can i get good tutorials for crystal reports using asp.net2.0
Thanks in Advance...
Erasers are for people who are willing to correct their mistakes.
|
|
|
|
|
|
HI
Is it posible to call asp.net function in javascript
Example
-
i have a javascript function in that i want to call the asp.net values
var customarray=new Array('in this i want to call asp.net values' );
var custom2 = new Array('something','randomly','different');
Than Q
Keerthi
|
|
|
|
|
Hi,
clarify it.
Thanks,
Sun Rays
To get something you must have to try once.
My Articles
|
|
|
|
|
You can do this with AJAX, or you can write the values you want into the script as variables.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thx For reply
my need is i have a javascript array in that array i want put asp.net array values
For Example :
------------------
in the place of 'an apple','alligator','elephant','pear' etc.. i want to put asp.net array values
var customarray=new Array('an apple','alligator','elephant','pear','kingbird','kingbolt', 'kingcraft','kingcup','kingdom','kingfisher','kingpin');
var custom2 = new Array('something','randomly','different');
Keerthi
|
|
|
|
|
OK, in this case, just write the values into your javascript from the code behind, no need to call it with AJAX, if the values are known, just pass them through.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi dear,
It is Possible to call c# function through javascript.
Please go through google, if again not able to find. plz write me at personalmail@mysampatti.com
By
Hello Forum
Always be in touch to help about the topic ASP.NET
|
|
|
|
|
u van also try by this trick
document.getElementbyId(HiddenButton).Click;
Hello Forum
Always be in touch to help about the topic ASP.NET
|
|
|
|