|
Using ASP.Net 2.0 and VS 2005.
One of the GridView columns is a bound HyperLink that sends me to a new aspx page. I bound it's DataText property with some field in the database.when I click this hyperlink it should redirect me to anothr page and also I want to grad the value of first cell in the selected row. How can I do that.
seema
|
|
|
|
|
Use ItemTemplate instead of BoundField and
Use HtmlAnchorTag instead of Hyperlink
Like as
<ItemTemplate>
<a href="Page.aspx?Id=<%#Eval("FirstFieldID")>"><%#Eval("SecondFieldName")></a>
</ItemTemplate>
Best Regard
Pathan
---------------------------------------------------
|
|
|
|
|
<asp:GridView ID="gvCode" runat="server" AllowPaging="True" AutoGenerateColumns="False" Width="784px" CellPadding="4"CellSpacing="2" font-size="8pt" headerstyle-backcolor="maroon" headerstyle-forecolor="khaki" headerstyle-font-bold="true" rowstyle-verticalalign="top" OnPageIndexChanging="gvCode_PageIndexChanging" style="z-index: 100; left: 9px; position: absolute; top: 18px" >
<Columns>
<asp:HyperLinkField DataNavigateUrlFields="S_LANGUAGE,SEARCH_ID" DataNavigateUrlFormatString="frmCodeInsert.aspx?lid={0}&sid={1}" DataTextField="S_DESC" NavigateUrl="frmCodeInsert.aspx" HeaderText="Description" >
<HeaderStyle CssClass="fontGridHeader" HorizontalAlign="Left" VerticalAlign="Top" />
<ItemStyle CssClass="fontGridItem" />
</asp:HyperLinkField>
</Columns>
<RowStyle VerticalAlign="Top" />
<HeaderStyle BackColor="Maroon" Font-Bold="True" ForeColor="Khaki" />
</asp:GridView>
in the DataNavigateUrlFields property of the hyperlink column you can specify which column value to be taken to next page, the S_LANGUAGE,SEARCH_ID, is the two values i am taking to the next page..
winnie
|
|
|
|
|
when i click a link as "..\xxx.ppt" or "..\xxx.pps" it asks "do you want to open or Save"
but i dont wantto see this message, let it just show the pps.
how could i do?
|
|
|
|
|
//Instantiate a Presentation object that represents a PPT file
Presentation pres=new Presentation();
//....do some work here.....
//Setting the content type of the Http Response
this.Response.ContentType = "application/vnd.ms-powerpoint";
//Appending the header of the Http Response to contain the presentation file name
this.Response.AppendHeader("Content-Disposition", "attachment; filename=demo.ppt");
//Flushing the buffers of Http Response
this.Response.Flush();
//Accessing the output stream of Http Response
System.IO.Stream st = this.Response.OutputStream;
//Saving the presentation to the output stream of Http Response
pres.Write(st);
//Closing the Http Response
this.Response.End();
I didn't get any requirements for the signature
|
|
|
|
|
I'm creating a website that needs to be extremely secure (medical company which must adhere to HIPAA security guidelines). So I'm a little leary about simply placing the names of my stored procedures into the "sqldatasource" control when populating gridviews, listviews, etc. I prefer to do all of that in my codebehind c-sharp page instead. So I'm just wondering if anyone who used the "sqldatasource" control feels there may be security issues with displaying db info on the aspx page.
I remember back in the days of classic ASP 3.0, there were times in which an error occurred on the server in which instead of displaying a web page, all of the asp code was displayed instead. If this were to happen with a sqldatasource control on the page, the viewer would then know way too much info about my database.
In fact I remember a scary incident involving my bank in which their online bank account site was coded in classic asp. One day I logged on and I received an asp error page which pointed out to me the exact location of the error in the asp code. I received 2 errors. 1st, the problem was their connection string. The 2nd problem was 1 of their queries, which were hardcoded into the asp code. So as you can guess, this displayed to me their server name, database name, table names, and table fields (needless to say, I closed my account with them the next day).
So I guess I'm just asking is, is there any security advantage to placing your calls to the database in the codebehind page rather than simply placing it in a sqldatasource control on the actual aspx page?
Thanks.
-Goalie35
|
|
|
|
|
Goalie35 wrote: So I'm a little leary about simply placing the names of my stored procedures into the "sqldatasource" control when populating gridviews, listviews, etc.
Aren't you doing a proper 3-tier architecture with a presentation layer, business objects and data layer. The stored procedure names should be no where near the presentation layer at all.
Goalie35 wrote: I remember back in the days of classic ASP 3.0, there were times in which an error occurred on the server in which instead of displaying a web page, all of the asp code was displayed instead. If this were to happen with a sqldatasource control on the page, the viewer would then know way too much info about my database.
Then use a DAL (Data Absrraction Layer) Here's a start[^]. The series isn't finished but it will get you going in the right direction.
Goalie35 wrote: So I guess I'm just asking is, is there any security advantage to placing your calls to the database in the codebehind page rather than simply placing it in a sqldatasource control on the actual aspx page?
You shouldn't have database code in your codebehind page. Period. Neither on your ASPX file. It should be properly architected to take it as far away from the presentation layer as possible.
|
|
|
|
|
I have a suggestion for you. It will ease your fears and make for a better application. Use Class Objects for all your data. When you want to bind them with a control return a generic list and use the objectdatasource.
Check here for a simple example
I didn't get any requirements for the signature
|
|
|
|
|
I've added a ReportViewer control to my page.
It shows all the icons in Design mode, but when I run the page (even on my PC) no icons show, just red x's.
There is a control property ToolbarImagesFolderUrl, but I don't know where to point it, or why it isn't defaulted at least.
"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."
"There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain..."
|
|
|
|
|
I have file Upload control on my page where I need to browse only PDF files but when browse button is clicked it shows *.* where it should be *.pdf, I am checking the file extension on post back as well but need user to view only PDF while browsing. Any Solutions ???
Regards
|
|
|
|
|
Do you want to validate only .PDF file to upload it?
Best Regard
Pathan
---------------------------------------------------
|
|
|
|
|
if you will read my message again with care you will understand.
I am saying "one click of browse button it shows *.* where I want to show *.pdf files"
Regards
|
|
|
|
|
BTW, I don't know how you are connected to ALM Soft but that is one of the worst web sites I have ever seen. You can practically see that one guy's balls. No one wants to see that.
I didn't get any requirements for the signature
|
|
|
|
|
hahaha .. Thanks for your comments. And offcourse there is always a first time. You must be thankful to see such a worst site through my link and About balls if you dont have then I think you dont like others as well...
I hope this helps you to understand your problem.
|
|
|
|
|
Hai All,
I am using .net1.1 With C# coding.....My Problem is that,In My Datagrid I give 2 Button Columns (One with Button Type= LinkButton and the other One's Button Type=Push Button)in the same row...There are 5 Columns in My Datagrid.While Clicking the Linkbutton I want to Redirect the Page showing the record Details page....And While Clicking the Push Button I want to Redirect To Full Record details Edit Page...In My DataGrid I Load only 5 items.Becoz I not want to Edit the Datagrid showing page itself....If any idea Please help me to solve....
Thanks and regards
Bijesh
|
|
|
|
|
Just put the redirect in the code behind for each button. What don't you know how to do?
I didn't get any requirements for the signature
|
|
|
|
|
Hello....
I am using DataGrid .....
With Button columns....How we can type codes in that specified button columns...(I have no Buttons)
Just put the redirect in the code behind for each button. then if you any idea please help
With Regrds
bijesh
|
|
|
|
|
Hi
function TotalBudgetAmount()
{
var intCount=2;
var txtBudgetAmount= document.getElementById("dgridBudgetAllocationDetails__ctl"+intCount+"_txtCurrentBudgetAmount");
var TotalAmount=0;
while (txtBudgetAmount != null)
{
alert("hai");
if (parseFloat(txtBudgetAmount.value))
TotalAmount = TotalAmount + parseFloat(txtBudgetAmount.value)
intCount += 1;
var txtBudgetAmount=document.getElementById("dgridBudgetAllocationDetails__ctl"+intCount+"_txtCurrentBudgetAmount");
}
var lblTotalBudgetAmount = document.getElementById("dgridBudgetAllocationDetails__ctl" +intCount+"_lblTotalAmount");
if (lblTotalBudgetAmount != null)
document.write("The number is "+ parseFloat(TotalAmount).toFixed(2))
}
this is my code here i need to add text bob value and put in to label but here values are not adding i thougt error in
var txtBudgetAmount= document.getElementById("dgridBudgetAllocationDetails__ctl"+intCount+"_txtCurrentBudgetAmount");
this line please review this and reply me thank u
reg
nantha
|
|
|
|
|
On Which Event U want to call this javascript?
Best Regard
Pathan
---------------------------------------------------
|
|
|
|
|
Hello,
My app creates some folders during the session,I want to clear these folders after user leave his session or close his browser ,I've put my code to the end session event handler but it doesn't work because the end session event fired only when session was expired or when system log off ,I don't know how to clear these folders.
Thanks.
Dad
|
|
|
|
|
I may just be repeating what you're already doing but just so I understand, are you using Session_End event within the global.asax file? If so, I believe you should still have your session value while within this event. The session should expire on the server immediately after this event is finished.
So something like the following should work (i believe):
void Session_End(object sender, EventArgs e)
{
if (!Convert.ToString(Session["UserId"]).Equals("")) //if not equal to ""
{
Response.Write(Session["UserId"]);
}
}
I have something like this in my code and it works fine. Hope that helps a little.
-Goalie35
|
|
|
|
|
The server session doesn't end when the user closes the browser or goes somewhere else, it ends when the server hasn't gotten a request from the user in a certain amount of time. The default timeout is 20 minutes.
---
single minded; short sighted; long gone;
|
|
|
|
|
your first step is to look at your source and work out the Ids of the controls, although if you just do that and use what you read, they could change if you change your page.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi
function TotalBudgetAmount()
{
var intCount=2;
var txtBudgetAmount= document.getElementById("dgridBudgetAllocationDetails__ctl"+intCount+"_txtCurrentBudgetAmount");
var TotalAmount=0;
while (txtBudgetAmount != null)
{
alert("hai");
if (parseFloat(txtBudgetAmount.value))
TotalAmount = TotalAmount + parseFloat(txtBudgetAmount.value)
intCount += 1;
var txtBudgetAmount=document.getElementById("dgridBudgetAllocationDetails__ctl"+intCount+"_txtCurrentBudgetAmount");
}
var lblTotalBudgetAmount = document.getElementById("dgridBudgetAllocationDetails__ctl" +intCount+"_lblTotalAmount");
if (lblTotalBudgetAmount != null)
document.write("The number is "+ parseFloat(TotalAmount).toFixed(2))
}
this is my code here i need to add text bob value and put in to label but here values are not adding i thougt error in
var txtBudgetAmount= document.getElementById("dgridBudgetAllocationDetails__ctl"+intCount+"_txtCurrentBudgetAmount");
this line please review this and reply me thank u
reg
nantha
|
|
|
|
|
i want to do email address validation in javascript.. can anyone help me out
lakshmanak
|
|
|
|