user1230825
user1230825

Reputation: 27

access variable from code behind page into aspx page

I am trying to access variable from code behind page into aspx page that is in HTML type. for that i am using the below code Note. I m binding StringBuilder stored it in a variable and I am trying to access that variable in my aspx page.

<input type= "text" name="keyword" value = "<%=MyKeyword.ToString %>"/>

but it is showing Error like The name 'MyKeyword' does not exist in the current context I am also try to access through Javascript but showing same error. can any body suggest what should i do?

Upvotes: 0

Views: 746

Answers (1)

KV Prajapati
KV Prajapati

Reputation: 94653

Declare MyKeyword with public access or create the public property.

public StringBuilder MyKeyword=new StringBuilder();

Upvotes: 1

Related Questions