[RESOLVED] Save Or Update in save page

can we save or update record in the table from the same page ???

Yes, we can.


Yes we can without an issue.

[RESOLVED] Dynamic Menu items

Does anyone know how to set a selected asp.net dynamic menu item to false?  I have multiple menus and when someone selects an item from one of the dropdown menus it changes color.  If I were to select an item from a different menu I need the other menus not to have the selected option anymore.

You have to save Selected Menu Item ValuePath and access the item with that path to clear selection

public string SelectedMenuPath
        return Convert.ToString(ViewState["SelectedMenuPath"]);
        ViewState["SelectedMenuPath"] = value;

Create a property like that and save the selected path in Menu ItemClick event

protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
    //save selected path
    SelectedMenuPath = e.Item.ValuePath;

You can clear selection in any other event as

if (!string.IsNullOrEmpty(SelectedMenuPath))
    Menu1.FindItem(SelectedMenuPath).Selected = false;

[RESOLVED] Default button

I have a form that contains a text box and 02 buttons. 1. Search, 2. Clear.

The user types some text in the text box and then click the search button to search for the phrase users has entered in the text box. I wanted to make the searh button default, So that the user after entring text simply press the enter button to search for the text, instead of explicitly clicking the search button.

Hi, you use:

Form.DefaultSubmitButton = "mySearchButton";


You can also use "defaultbutton" property of form tag in aspx page to make any Button in your aspx page as default Button.

try this

Form.DefaultButton ="btnSubmit"

Hope this code helps you

<asp:Panel runat="server" ID="SearchPanel" DefaultButton="btn_search">

             <asp:TextBox ID="tb_search" runat="server"  ToolTip="Enter your search criteria" />
             <asp:Button ID="btn_search" runat="server" Text="search" Font-Names="Arial" OnClick="btn_search_Click" />

             <asp:Button ID="btn_Clear" runat="server" />

Agree with Ramchandan.. You must use  Panel for achieve your functionality.

If you set Page's Default button property then for every unclicked thing it will fire DefaultButton Click which is wrong actually.


I wanted to make the searh button default, So that the user after entring text simply press the enter button to search for the text, instead of explicitly clicking the search button.

You can do that using Asp.net Focus API. please check out below link Focus API section :


[RESOLVED] display the bitmap image

Dear all,

i had drawed a graph by clicking a analyze button, however when i click it, it will go to a new screen. below is my coding:

Response.ContentType = "image/gif"

        objBitmap.Save(Response.OutputStream, ImageFormat.Gif)

below is the condition i want, when i click the button Analyze, the image (graph) is showed under the button with the header and template:


my current condition is when i click the button analyze, it will totaly display the graph only without the header and template as print screen below:


how to change the coding to let the template and heaser showed together with the bar chart?

hope can get reply from any of you. i am using vb.net

thanks in advanced.

you can drow images in a separate page. and put one image control in your current page.

 when button click event you can change  imagecontrol image url to previously mentioned page.


if you want ot know more about handing image check this link


[RESOLVED] A potentially dangerous Request.Form value was detected from the client ...

Hi there 

I am creating a small CMS, I have a page with an HTML editor. the user enters text, submit, this of course populates a sqlServer database. 

When I submit the form, I get the following error:

a potentially dangerous Request.Form value was detected from the client (ctl00$ContentPlaceHolder1$elm2="<p>Test</p>").

I tried different things:

- I added ValidateRequest="false" on the top of the page

- In the code behind which deals with the Insert to DB, my Insert parameter is as follow:

commI.Parameters.Add("@body", SqlDbType.Text);

commI.Parameters["@body"].Value = HttpUtility.HtmlEncode(elm2.Text);

None of the above have fixed it



Yes it is due to .net framework 4.0....

solution is put below tag under <system.web>.......


<httpRuntime requestValidationMode="2.0" ></httpRuntime>


add validateRequest="false" in your page directive and check it

If you just want to fix the error you can add the following to your .config file which will allow the ValidateRequest="false" directive to take effect with .net v4


<httpRuntime requestValidationMode="2.0"/>    


I am pretty sure thats all that needs to be done


enableEventValidation="false" viewStateEncryptionMode="Never" enableViewStateMac="false"

in the Page directive

On page directive set ValidateRequest="false" and your error will be solved......

You can try ClientScript.RegisterForEventValidation function & keep EventValidation ON.



If this doesn't help, please post your code. 

Thanks for that, that nailed it.