|
Hello,
I am using the Visual Studio Web Developer 2008 for programming in VB.NET and i have some problems:
1. Sometimes it stops highlighting the text.
2. Is there an option to refresh the Intellisense of the page?
3. When i am including files to my page, its say variable undefined.
Global information:
* I am not using the *.cs files.
* I am not using any .net button (example: asp:input...)
* I am using the include file. (example: include virtual=...)
If someone have any idea on how to fix this problem it will help me.
If not, Maby someone can suggest another program (with Intellisense)?
Thanks,
Roy Shoa.
|
|
|
|
|
In my gridview, I want to count the number of times each value (based of course on a field in my gridview) occurs. For example, if I have a field called Dept, in my result there is the following:
Dept A
Dept A
Dept A
Dept B
Dept B
Dept C
What I am trying to do is to show that for each Dept A, the count is 3, and for Dept B, the count is 2 and for Dept C the count is 1. When I have my count, I want to save them into my hidden field, which I am going to use else where in my code.
Here is my code:-
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
Table tbl = e.Row.Parent as Table;
TableCell cell = new TableCell();
CheckBox chk = new CheckBox();
Label lbl2 = new Label();
HiddenField rowValue = new HiddenField();
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Visible = false;
}
else
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Label lbl = (Label)e.Row.FindControl("lblValue");
string str1 = ((Label)(lbl)).Text;
string prevStr= (string)Session["previousStr"];
if (prevStr== str1)
{
counter = RememberDeptCount(str1)
}
else
{
prevStr= sr1 ;
Session["previousStr"] = prevStr;
counter = RememberDeptCount(prevStr)
if (tbl != null)
{
GridViewRow row = new GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal);
rowValue.ID = "hdnNumRows";
rowValue.Value = counter;
lbl2.Text = Convert.ToString(counter);
cell.ColumnSpan = this.GridView1.Columns.Count;
cell.Width = Unit.Percentage(100);
cell.BackColor = System.Drawing.Color.Aqua;
HtmlGenericControl span = new HtmlGenericControl("span");
span.InnerHtml = prevStr;
cell.Controls.Add(span);
cell.Controls.Add(chk);
cell.Controls.Add(lbl2);
cell.Controls.Add(rowValue);
row.Cells.Add(cell);
tbl.Rows.AddAt(tbl.Rows.Count - 1, row);
}
}
}
}
}
public int RememberDeptCount(string dept_name)
{
if (hash_dept.ContainsKey(dept_name))
{
int current_count = Convert.ToInt32(hash_dept[dept_name]);
hash_dept.Remove(dept_name);
current_count+=1
hash_dept.Add(dept_name, current_count);
return current_count;
}
else
{
hash_dept.Add(dept_name, 1);
current_count = 1;
return current_count
}
}
When I run the code in debug mode, and look at my counts being returned for each dept I am seeing the correct results. Unfortunately, when it comes to be shown as labels in each of the groups, I am not seeing the correct results. For example, I am currently seeing 1 for each group, not 3, 2, 1.
Can anyone please help me, I am really stuck?
|
|
|
|
|
Learn how to format the code you include in your post. No one is going to read this mess.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi there,
I have a login.aspx which has a login control which works fine using Form Auth using SqlMemberProvider
<location path="Secure">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
<authentication mode="Forms">
<forms loginUrl="Login.aspx" defaultUrl="~\Secure\ViewOrder.aspx" />
</authentication>
<sessionState timeout="30 /sessionState>
<authorization>
<allow users="*"/>
</authorization>
<membership defaultProvider="SqlMemberProvider">
but now I want to add in a Autologin page which takes a username query string and automatically authenicate the user.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If page.querystring("username") = "" Then
Response.Redirect("Login.aspx")
Else
Dim username As String = page.querystring("username")
Dim mu As MembershipUser = Membership.GetUser(username)
If Membership.ValidateUser(username, mu.GetPassword()) Then
If page.querystring("ReturnUrl") <> "" Then
FormsAuthentication.RedirectFromLoginPage(username, False)
Else
FormsAuthentication.SetAuthCookie(username, True)
Response.Redirect("~\secure\vieworder.aspx")
End If
Else
'some action if failed
End If
End If
End Sub
but don't know why the Response.Redirect("~\secure\vieworder.aspx") redirects me back to the original login page.... looks like the setauthcookie is not authenicating the passed in user properly?
any help would be appreciated.
thanks,
Still a newbie.. learning
modified on Sunday, January 24, 2010 6:04 PM
|
|
|
|
|
Learn how to format the code you include in your post. You won't get much help unless people can read what you've posted and you following the rules here.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Can you please make sure that whatever code you are putting are inside the code block tag, before posting the thread? This will help to fix the problem soon.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
sorry about that.. have fixed my previous post layout.. hopefully someone can give me some helps?
cheers,
Still a newbie.. learning
|
|
|
|
|
Any help anyone?
thanks,
Still a newbie.. learning
|
|
|
|
|
I have one table in SQL DB. It's call "articles" and one of the fields is call "title".
When I search for a cyrilic title in my articles in SQL BD, anything is not found. But when I search for a latin title, it works.
Here is my code:
protected void btnSearch_Click(object sender, EventArgs e)
{
SqlDataSource1.SelectCommand = "SELECT * FROM Articles WHERE Title LIKE '" + TextBox1.Text + "';";
DetailsView1.DataBind();
DetailsView1.Visible = true;
}
Please help
|
|
|
|
|
|
Hi to all,
Actually I am working on a e-commerce portal. We are using sage pay (payment gateway) for the transaction.While sending data to sage for transaction, the data should be encrypted. For this data should be encrypted using Simple XOR algorithm and then should be Base64 encoded. Can anyone have any idea about this. I am trying like this:
public void gencrypt()
{
string mycrypt = "";
key = "EnNj72dXmScJUX45";
string mystring = strPost;
string temp = "";
SimpleXor(mystring, key);
Base64Encode(temp);
}
public void SimpleXor(string strIn, string strkey)
{
int iInIndex;
int iKeyIndex;
string strReturn;
if (strIn.Length == 0 || strkey.Length == 0)
{
return;
}
iInIndex = 1;
iKeyIndex = 1;
strReturn = "";
for (int i = 0; i <= strIn.Length; i++)
{
for (int j = 0; j <= strkey.Length;j++ )
{
strReturn = strReturn + (strIn[i] ^ strkey[j]);
iInIndex = iInIndex + 1;
if (iKeyIndex == strIn.Length)
{
iKeyIndex = 0;
iKeyIndex = iKeyIndex + 1;
}
}
}
}
public void Base64Encode(string strplain)
{
}
Please assist me..
cheers,
sneha
|
|
|
|
|
I dont understand what your issue is - a little search prduces many ways of doing it, including this Implementing XOR cipher encryption / decryption in C#[^]
but in reality Im not sure I'd be sending payment info to Sage or anyone else using simple xor encryption - if thats what they recommend I certainly wouldnt be dealing with them
'g'
modified on Sunday, January 24, 2010 4:02 AM
|
|
|
|
|
Hi..
I got update panel in my master page and in one of my content pages I got modal popup extender.
after one post back of my content page it gets visible on second postback...
do u have any idea ?
thanx,
By:
Hemant Thaker
|
|
|
|
|
Try again to explain your problem. It is not clear what you are trying to accomplish or how you are going about it.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi..
thanks for reply.., i got some temparory solution,
I may draw your attention to this later on.
Thanks,
By:
Hemant Thaker
|
|
|
|
|
I am using this: btnDelete.Attributes.Add("onclick", "if(confirm('Are you sure you want to delete?')) Test1();else return false;")
my requirement is to be excute the function test1() but nothing happend
and iam also trying in this manner could anyone help me
Page.RegisterStartupScript("Confirm", "<script language=JavaScript>Confirm();</script>");
and in the aspx file (desiner) you need to write the following code
<script language="javascript" type="text/javascript">
Function Confirm() //Sample Function
{
var blnConfirm = confirm("sample function to test confirm function");
if(blnConfirm == true)
{
alert("you have clicked yes"); return false;
}
else
{
alert("you have clicked No");
}
}
</script>
|
|
|
|
|
use this code
<html>
<head>
<title>Custom ConFirm, Alert and Prompt</title>
<script language="javascript" type="text/javascript">
function FnConfirm()
{
var ans=confirm("Choose a button")
if (ans==true)
{
alert("You pressed OK");
FngoOK();
}
else
{
alert("You pressed Cancel");
FngoCancel();
}
}
function FngoOK()
{
window.location = "OK.htm";
}
function FngoCancel()
{
window.location = "Cancel.htm";
}
</script>
</head>
<body>
<input name="btnCheck" OnClick="FnConfirm()" Type="Button" Value="Click" />
</body>
</html> i tried this & working.
For server side you can do like this
btnDelete.Attributes.Add("onclick", "FnConfirm()")
|
|
|
|
|
thatraja wrote: btnDelete.Attributes.Add("onclick", "FnConfirm()")
Won't work without runat=Server on the input element.
Where did the OP ask about redirecting pages? and you are using far too much code to accomplish the very simple task
thatraja wrote: var ans=confirm("Choose a button")
You are uselessly creating another variable when this is enough
if( confirm("Choose a button") )<br />
...<br />
else<br />
...
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|Mark Nischalke wrote
1.Won't work without runat=Server on the input element.
2.Where did the OP ask about redirecting pages? and you are using far too much code to accomplish the very simple task
3.You are uselessly creating another variable when this is enough
=>1. I gave him a full HTML code and I was mentioned server side code will be like
btnDelete.Attributes.Add("onclick", "FnConfirm()") instead of
btnDelete.Attributes.Add("onclick", "if(confirm('Are you sure you want to delete?')) Test1();else return false;") also it wasn't mentioned as a client control by neither me or him.
=>2.Actually he called a function Test1() in his code so that i was created a 2 dummy functions for redirects based on the response for easy understand to him.
=>3.Here i copied his code & made some changes & posted here so i didn't created any new variable.
Happy coding Thanks
Regards,
thatraja
|
|
|
|
|
From your profile we can see you are not very proficient in these technologies. Perhaps do more studying before responding and answering.
thatraja wrote: btnDelete.Attributes.Add("onclick", "FnConfirm()")
This server side code can not be be called unless the client side element has the runat=Server attribute.
thatraja wrote: =>2.Actually he called a function Test1() in his code so that i was created a 2 dummy functions for redirects based on the response for easy understand to him.
Again, where is it stated by the OP that a redirected was needed? By added unnecessary features you may have done more to confuse than to help.
thatraja wrote: =>3.Here i copied his code & made some changes & posted here so i didn't created any new variable.
From this we can tell you are probably very profeccient at copy and paste coding and don't fully understand what you are doing. If you knew what you where doing you should have corrected the OPs code and explained why.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
You are right mate, still didn't completed my Master degree & i hope it will take a year to complete. And now i'm started to studying in latest things in those technologies so that i joined also Codeproject this month which is nice.
|Mark Nischalke wrote
This server side code can not be be called unless the client side element has the runat=Server attribute.
but here the btnDelete is a server side element so that i was added the attribute in runtime.
Again, where is it stated by the OP that a redirected was needed? By added unnecessary features you may have done more to confuse than to help.
I accept this one my mistake because i didn't thought about his confusion by the redirection code. It would be better if i put those alert messages instead of redirections inside those dummy functions.
From this we can tell you are probably very proficient at copy and paste coding and don't fully understand what you are doing. If you knew what you where doing you should have corrected the OPs code and explained why.Actually already he was posted some sample code which has some issue. But i thought it would be better to make some changes in that code instead of writing an new one because he may be confuse here too. Also i have waited for his response. That's all.
Thanks for your feedback
Mate can you help me for my study by preferring things in technologies. Also i have visited your profile page but your blog isn't write mode for me. how to contact you? Please help. Thanks.
|
|
|
|
|
I cant get you what you have studied if you are going to assist me in
learning technology i would be greatful and my mail id is mca.nath@gmail.com you can contact me through this maild
Thanks & Regards,
K. Amarnath.
|
|
|
|
|
Thanks for your help and i was to new to work with javascript
and if user clicks on ok then i have to redirect to another page
that is happening if on cancel then i have to focus him on a text
control. I will try for that. once again very thanks for your help
|
|
|
|
|
use the following script
<script language="javascript" type="text/javascript">
function FnConfirm()
{
if (confirm("Choose a button"))
{
window.location = "anotherpage.htm";
}
else
{
document.getElementById('anothertextbox').focus();
}
}
</script> Here 'anothertextbox' is the name of your another textbox.
|
|
|
|
|
Nath wrote: Page.RegisterStartupScript("Confirm", "Confirm();");
It is unnecessary to register the confirm script since you have already included it in the page.
<input type="button" value="Click Me" onClick="Confirm()"></input>
<script language="javascript" type="text/javascript">
function Confirm()
{
if (confirm("Are you sure you want to delete?"))
alert("Yes");
else
alert("No");
}
</script>
I know the language. I've read a book. - _Madmatt
|
|
|
|