|
RadioButtonList is rendering as radio buttons with html table.
So you cal add an onclick event to the asp:ListItem Something like below.
<br />
<asp:listitem text="T1" value="V1" onclick="GetVal('rbtnHeader_0');" ></asp:listitem><br />
<asp:listitem text="T2" value="V3" onclick="GetVal('rbtnHeader_1');" ></asp:listitem><br />
and the js is
<br />
function GetVal(cntrl)<br />
{<br />
var x=document.getElementById(cntrl);<br />
alert(x.value)<br />
}<br />
I dont know how good this is.But It will work.
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
|
|
|
|
|
how to change the cursor color when focus textbox Or readonly textbox or enabled false textbox
lav naphade
|
|
|
|
|
How to Solved Excel formula through vb.net,have any book which have all formula solution step by step for example LINEST and any other other formula. Please help me.
Thanks
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
You could ask it better in some other forum.
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
|
|
|
|
|
This is not an ASP.NET question. You CAN control Excel in VB.NET, there's an SDK for that. Your users will need Office, of course.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
NO i do not want to use Excel control,i want library or dll which contain the all formula of Excel . For Example:- Statistics,finance,math math and etc
Its not only asp.net question i think Dll and lib.use in both.
i have gated one link but its contain only finance formula.
www.visualnumerics.com/products/imsl/jmsl/v40/api/com/imsl/finance/accrintmEx1.java - 2k[^]
Please Help me.
Thankue
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
OK - sorry but your wording was not clear.
Your best bet is to just research and write the code for the formulas you want to use, I would expect. It's just a little math.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
Hi,
I have one html table, table contains rows and columns(cells). Now i want to do some animataion like Moving stripes of a cell.
How to do, or give me any suggestions to animate a cell dynamically using css or javascript or c#
Thanks and Regards
RakayaD
|
|
|
|
|
Animation is usually done using flash especially if you want the cells to move.
In my opionion it would be better not to use flash
We are not a Code Charity
|
|
|
|
|
Hi,
I am binding a data in a detail view at run time. But I also want to edit it at the run time. I have tried the following code.
Protected Sub Detailsview1_ItemUpdated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles Detailsview1.ItemUpdating
Dim index As Integer = Generic_DG.SelectedIndex
Dim con As New SqlConnection(ConfigurationManager.AppSettings("connectionString"))
Dim cmd As New SqlCommand()
cmd.CommandText = "UPDATE Products SET ProdName=@ProdName where ProdId=@ProdId"
cmd.Connection = con
cmd.Connection.Open()
cmd.ExecuteNonQuery()
cmd.Connection.Close()
End Sub
How can I replace @ProdName with data in a detail view?
OR
Which property of the detailview I have to use for it?
Rock Star
modified on Friday, July 4, 2008 4:16 AM
|
|
|
|
|
Hi
Have a look at this
Details View[^]
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
|
|
|
|
|
Hi,
I am planning to use dbprovider factory class and retrieving and binding the detailsview with the dataset at runtime. And now I want to edit the data in it. I am not using a data source. So how can I edit the data in a detail view now. So what code or property should I add in a detailsview to update the data in a detailsview.
Rock Star
|
|
|
|
|
Hi,
How to check whether the session is created or not in c#? I am using like If (Session("Name") == null), but it is showing error named, object reference is not set to an object. tnx in adv.
Balasubramanian K.
|
|
|
|
|
if (Session["Name"] != null)
{
stName = Session["Name"].ToString();
}
else
{
stName= "";
}
something like the above
We are not a Code Charity
|
|
|
|
|
tnx. It is working fine.
If it is working with !=, why it is not working with '=='. Why it throws error?
Balasubramanian K.
|
|
|
|
|
It should work!
Can you copy and paste your coding.
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
|
|
|
|
|
BalasubramanianK wrote: why it is not working with '=='
if you are comparing with a string, like
if(nameStr==Session["name"] )<br />
;
then, for that you need to first use ToString().
like this ...
if(nameStr==Session["name"].ToString()) <br />
;
Is these you were looking for ... ?
|
|
|
|
|
BalasubramanianK wrote: If it is working with !=, why it is not working with '=='. Why it throws error?
Do you know what != and == means ? First one is checking inequality and second is equality checking. So if you write
if(Session["name"] == NULL)
string name = Session["name"].ToString(); will throw error as you are trying to access a method in a NULL referenced object. If you change the code to
if(Session["name"] != NULL)
string name = Session["name"].ToString(); , you are accessing ToString() only when Session["name"] exist.
Hope it helps
|
|
|
|
|
Hi everybody
I am developing a web project usin asp.net 2005 and sql erver 2000.
In web.config file when i gave Computer name then it connects but when I give IP address it gives following message
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005,
this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.
(provider: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.)
Can anybody tell me what is Problem?
Raghvendra Kumar Roy
|
|
|
|
|
This is appearing frequently in discussions. Have you done a search ?
|
|
|
|
|
Code:
foreach(int strAlternative in Suggest(arrWords[iCurrentCount]))-->Error Line
{
lbSuggestions.Items.Add(new ListItem(strAlternative, strAlternative));
}
|
|
|
|
|
what are contents of arrWords?
Is it a string array? If yes, 'strAlternative' is also string
rockram wrote: foreach(int strAlternative in Suggest(arrWords[iCurrentCount]))
I've a confusion with the above line.
Is arrWords a double dimension array?
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
|
|
|
|
|
StrAlternative is an integer
Sutheesh Ramachandran
Cybernet Software Systems,
T Nagar, Chennai 17.
|
|
|
|
|
I meant, It should be a string
EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.
|
|
|
|
|
Hello sir
Thanks for your reply
Here is my code:
using System;
using System.IO;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
partial class SpellSuggest : System.Web.UI.Page
{
private string[] strDictArray;
private bool boolDictionaryLoaded = false;
private int intErrors = 0;
protected void Page_Load(object sender, System.EventArgs e)
{
int iCurrentCount = 0;
string[] arrWords;
string strCompleteOriginal = "";
int iWordCount = 0;
//string hfOriginalString.Value, hfCurrentCount.Value, hfErrors.Value, hfWordCount.Value;
char[] chSplit ={ ' ' };
//string strAlternative = "";
int i = 0;
string strText;
strText = Request.QueryString["txtContent"];
strText = strText.Trim();
// If nothing to check, exit the procedure
if (strText == "")
{
return; // TODO: might not be correct. Was : Exit Sub
}
else
{
// Get the string to check
strCompleteOriginal = strText;
}
// First time the page is loaded
if (!IsPostBack)
{
// Initialize current word index to zero
iCurrentCount = 0;
// Initialize total word count to zero
iWordCount = 0;
// Initialize total invalid word count to zero
intErrors = 0;
// Set value of hidden field containing complete original string to check
hfOriginalString.Value = strCompleteOriginal;
// Set value of hidden field containing current index
hfCurrentCount.Value = "0";
// Split into an array of individual words
arrWords = strCompleteOriginal.Split(chSplit);
// Count total number of words
iWordCount = arrWords.Length;
// Set value of hidden field containing total number of words
hfWordCount.Value = Convert.ToString(iWordCount);
// Set value of hidden field containing total number of invalid words
hfErrors.Value = "0";
}
else
{
// Not the first time, split hidden field into an array of individual words
arrWords = hfOriginalString.Value.Split(chSplit);
// Get index for current word in the array
iCurrentCount = Convert.ToInt32(hfCurrentCount.Value);
// Get current number of invalid words from hidden field
intErrors = int.Parse(hfErrors.Value);
}
// Set the current word being checked textbox value
txtCurrent.Text = arrWords[iCurrentCount];
// User has chosen to stop searching
if (Request.Form["cmdCancel"] == "Stop")
{
// Get our array of words from hidden field
arrWords = hfOriginalString.Value.Split(chSplit);
// Get total number of words from hidden field
iWordCount = Convert.ToInt32(hfWordCount.Value);
// Start with the words already corrected
string strReplace = hfFinal.Value;
int j = 0;
// Now add the rest of the un-checked words
for (j = iCurrentCount; j <= iWordCount - 1; j++)
{
strReplace += arrWords[j] + " ";
}
// The last invalid word was never fixed
intErrors -= 1;
// Notify the user and close the spell check window
stopChecking("frmSpellCheck", "txtContent", strReplace);
// Exit the procedure, we're done
return; // TODO: might not be correct. Was : Exit Sub
}
// If we're returning from a suggestion that has been selected or a manually
// entered word
if (Request.Form["cmdNext"] == "Next")
{
// Get our array of words from hidden field
arrWords = hfOriginalString.Value.Split(chSplit);
// Get total number of words from hidden field
iWordCount = Convert.ToInt32(hfWordCount.Value);
// If the user has selected a suggestions form the list
if (txtManual.Text == "")
{
// Update word in array
arrWords[iCurrentCount] = lbSuggestions.SelectedValue;
// Append corrected word to string containing completed valid text
hfFinal.Value += lbSuggestions.SelectedValue + " ";
}
else
{
// If the user has manually entered the word
// Update word in array
arrWords[iCurrentCount] = txtManual.Text;
// Append corrected word to string containing completed valid text
hfFinal.Value += txtManual.Text + " ";
}
// Clear out the Current word and manual word textboxes, ready for the next one
txtManual.Text = "";
txtManual.Text = "";
// Increment the current word index
iCurrentCount += 1;
// Set the hidden field containing the current index
hfCurrentCount.Value = Convert.ToString(iCurrentCount);
// Now carry on checking the rest of the text
for (i = iCurrentCount; i <= iWordCount - 1; i++)
{
// Set the value of the current word being checked textbox
txtCurrent.Text = arrWords[iCurrentCount];
LoadDictArray("dict-large.txt", arrWords[iCurrentCount].Substring(0));
// If the current word contains non-text characters, just add to the final string and move on
if (PrepForSpellCheck(arrWords[iCurrentCount]) == false)
{
hfFinal.Value += arrWords[iCurrentCount] + " ";
// Increment the current word index
iCurrentCount += 1;
// Set the hidden field containing the current index
hfCurrentCount.Value = Convert.ToString(iCurrentCount);
}
// If the current word is a number, just add to the final string and move on
else if (IsNumeric(arrWords[iCurrentCount]))
{
hfFinal.Value += arrWords[iCurrentCount] + " ";
// Increment the current word index
iCurrentCount += 1;
// Set the hidden field containing the current index
hfCurrentCount.Value = Convert.ToString(iCurrentCount);
}
// If the word is valid, just add to the final string and move on
else if (SpellCheck(arrWords[iCurrentCount]))
{
hfFinal.Value += arrWords[iCurrentCount] + " ";
// Increment the current word index
iCurrentCount += 1;
// Set the hidden field containing the current index
hfCurrentCount.Value = Convert.ToString(iCurrentCount);
}
else
{
// Increment the number of invalid words
intErrors += 1;
// Set the hidden field containing the number of invalid words
hfErrors.Value =Convert.ToString(intErrors);
// Invalid word, suggest some alternatives
// Clear out list from previous suggestions
lbSuggestions.Items.Clear();
// Add each suggested word to the list
foreach(string strAlternative in Suggest(arrWords[iCurrentCount]))
{
lbSuggestions.Items.Add(new ListItem(strAlternative, strAlternative));
}
// add the original item to the list of suggestions in case it's not in our dictionary
lbSuggestions.Items.Insert(0, new ListItem(arrWords[iCurrentCount], arrWords[iCurrentCount]));
// select the original item in the list by default
lbSuggestions.SelectedIndex = 0;
break; // TODO: might not be correct. Was : Exit For
}
}
// If we've checked all the words in the original text
if (iCurrentCount == iWordCount)
{
// Notify the user and close the spell check window
finishedChecking("frmSpellCheck", "txtContent", hfFinal.Value);
}
// Exit the procedure, we're done
return; // TODO: might not be correct. Was: Exit Sub
}
// check the current word and if invalid, suggest alternatives
for (i = 0; i <= iWordCount - 1; i++)
{
txtCurrent.Text = arrWords[iCurrentCount];
LoadDictArray("dict-large.txt", String.Left(arrWords[iCurrentCount], 1));
// If the current word contains non-text characters, just add to the final string and move on
if (PrepForSpellCheck(arrWords[iCurrentCount]) == false)
{
hfFinal.Value += arrWords[iCurrentCount] + " ";
// Increment the current word index
iCurrentCount += 1;
// Set the hidden field containing the current index
hfCurrentCount.Value = Convert.ToString(iCurrentCount);
}
// If the current word is a number, just add to the final string and move on
else if (Information.IsNumeric(arrWords[iCurrentCount]))
{
hfFinal.Value += arrWords[iCurrentCount] + " ";
// Increment the current word index
iCurrentCount += 1;
// Set the hidden field containing the current index
hfCurrentCount.Value =Convert.ToString(iCurrentCount);
}
// If the word is valid, just add to the final string and move on
else if (SpellCheck(arrWords[iCurrentCount]))
{
hfFinal.Value += arrWords[iCurrentCount] + " ";
// Increment the current word index
iCurrentCount += 1;
// Set the hidden field containing the current index
hfCurrentCount.Value =Convert.ToString(iCurrentCount);
}
else
{
// Increment the number of invalid words
intErrors += 1;
// Set the hidden field containing the number of invalid words
hfErrors.Value =Convert.ToString(intErrors);
// Invalid word, suggest some alternatives
// Clear out list from previous suggestions
lbSuggestions.Items.Clear();
// Add each suggested word to the list
foreach (string strAlternative in Suggest(arrWords[iCurrentCount]))
{
lbSuggestions.Items.Add(new ListItem(strAlternative, strAlternative));
}
// add the original item to the list of suggestions in case it's not in our dictionary
lbSuggestions.Items.Insert(0, new ListItem(arrWords[iCurrentCount], arrWords[iCurrentCount]));
// select the original item in the list by default
lbSuggestions.SelectedIndex = 0;
// Exit the loop so that the user can select a suggestion or
// type their corrected word
break; // TODO: might not be correct. Was : Exit For
}
}
// If we've checked all the words in the original text
if (iCurrentCount == iWordCount)
{
// Notify the user and close the spell check window
finishedChecking("frmSpellCheck", "txtContent", hfFinal.Value);
}
}
private void stopChecking(string strFormName, string strTextboxName, string strText)
{
// Hide the table with the current word and suggestions
tblMain.Visible = false;
// Insert the onload javascript to alert the user that the check has completed
// and update the source textbox and close the spellchecker window
StringBuilder sbJavascript = new StringBuilder();
sbJavascript.Append("<script language=\"javascript\" type=\"text/javascript\">");
sbJavascript.Append("alert(\"The spell check was stopped successfully (" + intErrors + " error(s) were fixed).\");");
sbJavascript.Append("window.opener." + strFormName + "." + strTextboxName + " = '" + strText + "';");
sbJavascript.Append("window.opener." + strFormName + ".cmdCheckSpelling.disabled = false;");
sbJavascript.Append("self.close();");
sbJavascript.Append("</script>");
Page.ClientScript.RegisterStartupScript(System.Type.GetType("System.String"), "onload", sbJavascript.ToString);
}
private void finishedChecking(string strFormName, string strTextboxName, string strText)
{
// Hide the table with the current word and suggestions
tblMain.Visible = false;
// Insert the onload javascript to alert the user that the check has completed
// and update the source textbox and close the spellchecker window
StringBuilder sbJavascript = new StringBuilder();
sbJavascript.Append("<script language=\"javascript\" type=\"text/javascript\">");
sbJavascript.Append("alert(\"The spell check has completed successfully (" + intErrors + " error(s) found).\");");
sbJavascript.Append("window.opener." + strFormName + "." + strTextboxName + " = '" + strText + "';");
sbJavascript.Append("window.opener." + strFormName + ".cmdCheckSpelling.disabled = false;");
sbJavascript.Append("self.close();");
sbJavascript.Append("</script>");
Page.ClientScript.RegisterStartupScript(System.Type.GetType("System.String"), "onload", sbJavascript.ToString);
}
private void LoadDictArray(string strPath, string strBegin)
{
bool boolStart = false;
string strCurrent = "";
string strFinal = "";
// Open our dictionary file
StreamReader srDictionary = new StreamReader(HttpContext.Current.Server.MapPath(strPath));
// Check each line and loop while there is another
while (srDictionary.Peek() != -1)
{
// Read the current line
strCurrent = srDictionary.ReadLine();
// Does the first character match our word's
if (String.LCase(String.Left(strCurrent, 1)) == String.LCase(strBegin))
{
boolStart = true;
// Only add words beginning with the same letter as the current word
strFinal += strCurrent + Constants.vbNewLine;
}
// Exit, we have all our relevant words
if(boolStart == true & String.LCase(String.Left(strCurrent, 1)) != String.LCase(strBegin))
{
break; // TODO: might not be correct. Was : Exit While
}
}
// Close the streamreader
srDictionary.Close();
// Split our string into an array of suitable words
strDictArray = String.Split(strFinal, Constants.vbNewLine);
strCurrent.Substring(1).ToLower() == strBegin.ToLower());
}
private bool PrepForSpellCheck(string strWord)
{
string strValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'-";
int i = 0;
string strLetter = "";
bool boolValid = false;
for (i = 1; i <= String.Len(strWord); i++)
{
strLetter = String.Mid(strWord, i, 1);
if (String.InStr(strValidChars, strLetter) > 0)
{
boolValid = true;
}
else if (i < String.Len(strWord))
{
boolValid = false;
break; // TODO: might not be correct. Was : Exit For
}
}
return boolValid;
}
private bool SpellCheck(string strWord)
{
int iFirst;
int iLast;
int iMiddle;
bool retValue = false;
if (String.Len(strWord) > 1)
{
iFirst = Information.LBound(strDictArray);
iLast = Information.UBound(strDictArray);
while (iFirst <= iLast)
{
iMiddle = (iFirst + iLast) / 2;
if (String.LCase(strDictArray(iMiddle)) == String.LCase(strWord))
{
retValue = true;
break; // TODO: might not be correct. Was : Exit Do
}
else if (String.LCase(strDictArray(iMiddle)) < String.LCase(strWord))
{
iFirst = iMiddle + 1;
}
else
{
iLast = iMiddle - 1;
}
}
}
else
{
retValue = true;
}
return retValue;
}
private string Soundex(string strString)
{
int i;
string strLetter;
string strCode;
string strSoundex = "";
strSoundex = String.UCase(String.Left(strString, 1));
for (i = 2; i <= String.Len(strString); i++)
{
strLetter = String.UCase(String.Mid(strString, i, 1));
switch (strLetter)
{
case "B":
case "P":
strCode = "1";
break;
case "F":
case "V":
strCode = "2";
break;
case "C":
case "K":
case "S":
strCode = "3";
break;
case "G":
case "J":
strCode = "4";
break;
case "Q":
case "X":
case "Z":
strCode = "5";
break;
case "D":
case "T":
strCode = "6";
break;
case "L":
strCode = "7";
break;
case "M":
case "N":
strCode = "8";
break;
case "R":
strCode = "9";
break;
default:
strCode = "";
break;
}
if (String.Right(strSoundex, 1) != strCode)
{
strSoundex = strSoundex + strCode;
}
}
return strSoundex;
}
private int WordSimilarity(string strWord, string strSimilarWord)
{
int functionReturnValue = 0;
int intWordLen;
int intSimilarWordLen;
int intMaxBonus;
int intPerfectValue;
int intSimilarity;
int i;
intWordLen = String.Len(strWord);
intSimilarWordLen = String.Len(strSimilarWord);
intMaxBonus = 3;
intPerfectValue = intWordLen + intWordLen + intMaxBonus;
intSimilarity = intMaxBonus - Abs(intWordLen - intSimilarWordLen);
for (i = 1; i <= intWordLen; i++)
{
if (i <= intSimilarWordLen)
{
if (String.LCase(String.Mid(strWord, i, 1)) == String.LCase(String.Mid(strSimilarWord, i, 1)))
{
intSimilarity = intSimilarity + 1;
}
if (String.LCase(String.Mid(strWord, intWordLen - i + 1, 1)) == String.LCase(String.Mid(strSimilarWord, intSimilarWordLen - i + 1, 1)))
{
intSimilarity = intSimilarity + 1;
}
}
}
functionReturnValue = intSimilarity / intPerfectValue;
return functionReturnValue;
return functionReturnValue;
}
private string[] Suggest(string strWord)
{
string[] functionReturnValue = null;
string strSoundex = "";
int i = 0;
string strSuggestions = "";
int intMaxSuggestions = 0;
int intSuggestionCount = 0;
string strSuggestion = "";
string[] strSuggestionArray;
double[] dblSimilarityArray;
double dblSimilarity = 0;
intMaxSuggestions = 10;
strSoundex = Soundex(strWord);
while (i <= Information.UBound(strDictArray))
{
if (Strings.LCase(Strings.Left(strDictArray(i), 1)) != Strings.LCase(Strings.Left(strWord, 1)))
{
i = i + 1;
}
else
{
break; // TODO: might not be correct. Was : Exit Do
}
}
while (i <= Information.UBound(strDictArray))
{
if (Strings.LCase(Strings.Left(strDictArray(i), 1)) == Strings.LCase(Strings.Left(strWord, 1)))
{
if (Soundex(strDictArray(i)) == strSoundex)
{
if (strSuggestions + "" == "")
{
strSuggestions = strDictArray(i);
}
else
{
strSuggestions = strSuggestions + "|" + strDictArray(i);
}
}
i = i + 1;
}
else
{
break; // TODO: might not be correct. Was : Exit Do
}
}
functionReturnValue = Strings.Split(strSuggestions, "|");
if (Information.UBound(functionReturnValue) < intMaxSuggestions)
{
intSuggestionCount = Information.UBound(functionReturnValue);
}
else
{
intSuggestionCount = intMaxSuggestions - 1;
}
// ERROR: Not supported in C#: ReDimStatement
// ERROR: Not supported in C#: ReDimStatement
foreach ( strSuggestion in functionReturnValue)
{
dblSimilarity = WordSimilarity(strWord, strSuggestion);
i = intSuggestionCount;
while (dblSimilarity > dblSimilarityArray(i))
{
if (i < intSuggestionCount)
{
strSuggestionArray(i + 1) = strSuggestionArray(i);
dblSimilarityArray(i + 1) = dblSimilarityArray(i);
}
strSuggestionArray(i) = strSuggestion;
dblSimilarityArray(i) = dblSimilarity;
i = i - 1;
if (i == -1)
{
break; // TODO: might not be correct. Was : Exit Do
}
}
}
functionReturnValue = strSuggestionArray;
return functionReturnValue;
return functionReturnValue;
}
}
if possible u can help me
This is regarding spellcheck
|
|
|
|
|