|
Can't you keep buttons and gridview on same form??
If not then do something like
Session["click"]="button1" // on the click on Button1
Session["click"]="button2" //on the click on Button2
In the page where you have gridview check..
If(Session["click"].Tostring()=="button1")
//Disable your gridview link buttons
else
//Enable your gridview link buttons
himanshu
|
|
|
|
|
thanx... wel got another code too whch worked out... check dis out...
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("http://Gridview.aspx?ctl=1");
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("http://Gridview.aspx?ctl=2");
}
Now in de page wer de grid is present
Int32 str = Convert.ToInt32(Request.QueryString["Ctl"]);
if (str == 1)
{
//enable de edit button
}
else
{
//enable de delete button
}
Thanx a lot....
|
|
|
|
|
yup same thing.you can either use session or query string
himanshu
|
|
|
|
|
please help me
i want to find htmlhyperlink in gridview and set image url blank for this hyperlink on some condition.i have tried with following
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
string status = ((DataRowView)e.Row.DataItem)["Status"].ToString();
if (status == "No Change")
{
setimageurl(e.Row.Controls);
}
}
protected void setimageurl(ControlCollection cc)
{
foreach (Control co in cc)
{
if (co.HasControls())
{
setimageurl(co.Controls);
}
HyperLink Brand = co as HyperLink;
if (Brand == null)
{
Brand.ImageUrl = "";// but here i found Object reference not set to an instance of an object error
}
}
}
sir i am sorry but please make it clear i am unable to understand.
modified on Thursday, June 18, 2009 4:43 AM
|
|
|
|
|
You're not likely to 'find' them, you're better off parsing them on the way in, during data binding.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
hello there,
i am having a small problem, iam a bit new to ASP.net programming
i had some pages that i was working on, and added the master page, now i cant see the content of those pages when i go to the design view, as far as i know this is something normal, but what i dont know is how to be able to see the content again ??
thank you
|
|
|
|
|
You should never use the design view anyhow, it has always been rubbish.
Having said that, you should be able to see your pages in the design view, there's no reason why you would not.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
I agree.
Designing through design view means lots of unnecessary html styles which is just increases your page size.
|
|
|
|
|
hi...
In my application i created a generic handler an i called the generic handler in my page.. the code is given bellow
<asp:gridview id="GridView1" runat="server"
="" gridlines="Vertical" autogeneratecolumns="false">
<columns>
<asp:boundfield datafield="Video_Name" headertext="Name">
<asp:templatefield headertext="Video">
<itemtemplate>
<object id="player" classid="clsid:6BF52A52-394A11DB153-00C04F79FAA6" height="170" width="300">
<param name="url" value="<%# "HandlerAudioVideo.ashx?id=" + Eval("id")%>" />
<param name="showcontrols" value="true" />
<param name="autostart" value="true" />
but when i use this codes in mozilla and safari it does nt call the handler but when i use IE as my browser it gets called and the page is function as well...
Oopppzz!!!!!!!
modified on Thursday, June 18, 2009 3:54 AM
|
|
|
|
|
What handler ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
clsid can be accessed only through IE.
Use object tag for IE only...
For Mozilla or Safari use Embed Tags.
|
|
|
|
|
suppose in my asp.net based project there is many hyperlink and when user click on those link then pdf file will be opened in browser.i want to know is there anyway if user just knows the url of pdf file and then he can directly type the url and press enter and then pdf file will be opened in browser. i want to know basically how can i prevent user to access my pdf directly if he is authenticated user. i just want that user has to access pdf file by clicking on hyperlink. so please guide me for this.
tbhattacharjee
|
|
|
|
|
If the PDF is in your Website and on a aspx page, then its simple , because you have to check if the user has logged in first before a user can access the secure page. If you are not doing that, then you have to start doing it
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Also if you dont want to create asp.net pages to check authentication, you can also use custom HTTPHandler for .pdf files.
|
|
|
|
|
That is Correct
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
On the contrary, Vuyiswa, it is not as simple as you explain.
I have encountered a similar problem before.
I think the original question was: "If a user knows the absolute url to a pdf, how can we prevent them from seeing it?"
Obviously, since the pdf files are most likely kept in a virtual directory of a website, opening them should not be a problem at all (if one knows the virtual directory and the filename).
The way I did it was, I kept the pdf files in a private folder and read them using System.IO, then through the application streamed them and eventually displayed them.
I have tried various things, but the way I did it seemed like the most reasonable thing to do, and, well, secure (hopefully).
var question = (_2b || !(_2b));
|
|
|
|
|
The way I do this stuff, and the best way, is to have a http handler, which will not return the file ( whose actual path is hidden ), unless the link came from my site also.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Yeah, I failed miserably doing that.
Gotta do some more reading on HTTPHandlers, it would seem.
var question = (_2b || !(_2b));
|
|
|
|
|
Using http handler is a much simpler as Abhishek Sur said.
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
And also place the file in a directory which cant be found from the Virtual path, means dont place it inside a virtual directory.
Just get the file through the handler from an unknown location, (say C:\private)
That will do the trick ..
|
|
|
|
|
True
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
after rendering aspx page the html shows in browser and if we see the source of the page then user can see raw html. if there is anyway as a result i can encrypt html content after rendering it to browser but browser can read and show the result.if i can encrypt then user can not understan what is written in my html due to security reason. if it is possible then please let me know in detail.
tbhattacharjee
|
|
|
|
|
I think it is not possible to encrypt your HTML.. as otherwise your browser will not render it correctly. Rather what you can do, is just strip spaces and new lines from the html so that everything will be rendered in a single line.
Do it in your custom handler. Also use GZip/Deflate compression to shrink the response.
s = Regex.Replace(s, "^\\s*",string.Empty, RegexOptions.Compiled | RegexOptions.Multiline);
s = Regex.Replace(s, "\\r\\n", string.Empty, RegexOptions.Compiled | RegexOptions.Multiline);
s = Regex.Replace(s, "<!--*.*?-->", string.Empty, RegexOptions.Compiled | RegexOptions.Multiline);
Just use regEx replace to do your job easy in your custom StreamFilter.
Hope you understand.
|
|
|
|
|
Hi all,
I want to put this java script ["window.open('Organization.aspx','mywindow','width=750,height=600')"; ]
in treeview event TreeView1_SelectedNodeChanged1
so that on click of every node or sub node this window would open..
help me out please thanx
never let you down...always be happy..
|
|
|
|
|
try this
if (!IsPostBack)
{
TreeNode Parentnode = new TreeNode("Home");
TreeNode node = new TreeNode("Organization","","","'Organization.aspx","_blank");
Parentnode.ChildNodes.Add(node);
TreeView1.Nodes.Add(Parentnode);
}
|
|
|
|