|
i have a datalist template hyperlink..if i click on tat i have to pass a query string to the response page...
the query string is a dynamic one...
for eg if im displaying a user name n password in the datalist i have to pass userid as querystring of the corresponding selected username..
how can i do tat??\plz help me out.
|
|
|
|
|
Hi,
I could not find any direct way to do this.
But u can use ItemDataBound event of datalist.
U need to put hyperlink in datalist ItemTemplate without setting its NavigateUrl property.
This property u can set at runtime while datalist it bound to the datasource.
Your hyperlink should be like following.
<asp:HyperLink ID="HyperLink1" runat="server"></asp:HyperLink>
I have put one label control which will have the value which we want make querystring.
I have set its visible property = false;
<asp:Label ID="lblusernamehidden" runat="server" Text='<%# Eval("username") %>' Visible="false"></asp:Label>
now I am setting hyperlink's navigateurl property in ItemDataBound event of datalist.
protected void dlst_ItemDataBound ( object sender, DataListItemEventArgs e )
{
HyperLink hl = ( HyperLink )e.Item.FindControl( "HyperLink1" );
Label lbl = ( Label )e.Item.FindControl( "lblusernamehidden" );
if ( hl != null && lbl != null )
{
hl.NavigateUrl = "~/TargetPage.aspx?username=" + lbl.Text;
}
}
this way you can get querystring dynamically in hyperlink.
also set Datalist's OnItemDataBound property to "dlst_ItemDataBound".
I hope this will help you.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
thank you...its working.....
|
|
|
|
|
in my gridview i have a textbox in footer . I want to validate the textbox for required field through javascripting since i donot want to use required field validator .Please give me the codings .
i can come inside the function but could not get textbox value.?????
i had like this.
function checkformtype()
{
alert();
var formtype=document.getElementById("txtFormType1").value;
alert(formtype);
if (formtype=="")
{
document.getElementById("Lblrequiredformtype").innerText ="Please enter the form type ";
alert( document.getElementById("Lblrequiredformtype").innerText);
return false;
}
return true;
}
|
|
|
|
|
have you checked the actual output name in the page source, you may find it is something like "Gridview1$txtFormType1"
Russ
|
|
|
|
|
Hi..
How can i get form id of form from which request is sent? Actually I have menu file which is created in javascript and I want to redirect to the home page of second application. I m calling the PostPage function on click of that menu. But this menu can be clicked from any form of the 1st application.
So please tel me how can i do this task?
function PostPage()
{
document.form1.action = "http://Ip-address/issuetracker/";
document.form1.method = "POST";
document.form1.submit();
return
}
Gurudatta B. Shelke
|
|
|
|
|
rather than form ID use forms[0] like this
document.forms[0].action =".."
Nobody is perfect i'm Nobody
|
|
|
|
|
Hi All,
Whenever we click on a button(ex:- Save button) the whole page is get loaded again in ASP.NET with c#
My second prolbelm is :-
How to save the text or data from a textbox of ASP.NET form into a MS-Word file
Plz give me the appropriate solutions
Thnx in advance
|
|
|
|
|
The Knowledge wrote: Whenever we click on a button(ex:- Save button) the whole page is get loaded again in ASP.NET with c#
That is how it is working. It will postback the data. If you are doing anything in pageload and you don't want to execute that when page is postingaback, write that in
!isPostBack<br />
<br />
<code>if ( !isPostBack )
{
}
</code>
|
|
|
|
|
U can use following code block to creat the output in word file.where u'll need to use the name of control in place of CTRL below, which have data to send to output file.
Response.Clear()
Response.AddHeader("content-disposition", "attachment;filename=FileName.doc")
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.Buffer = True
Response.ContentType = "application/vnd.word"
Me.EnableViewState = False
Dim oStringWrtr As New System.IO.StringWriter
Dim oHTMLTxtWrtr As New System.Web.UI.HtmlTextWriter(oStringWrtr)
CTRL.RenderControl(oHTMLTxtWrtr)
Response.Write(oStringWrtr.ToString())
Response.End()
With Thanks & Regards
Amit Sk Sharma
|
|
|
|
|
You want to create a Word file on the server or the client ?
The Knowledge wrote: Whenever we click on a button(ex:- Save button) the whole page is get loaded again in ASP.NET with c#
I recommend buying a book on ASP.NET and working through it, you obviously have no idea how it works.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Form A displays qty and other details, allows user to purchase item by entering required qty.
If Form A is used by user, and for the first user it display 500 and he enters the qty he wants to purchase is 100, Form A should display for the second user with qty 400 even though qty is not posted to database.
Thank you
kvijaya@jyothy.com
vijaya
|
|
|
|
|
That in the long run, will be a bad application design. It's far far maintainable and trustworthy if you post each transaction to the database. You can always rollback transactions if they were not completed or cancelled.
As for your requirements, you can save the total available quantity in a global static variable and subtract each user's quantity from it.
SG
|
|
|
|
|
Hi,
I have an application that generates .html and .mht files.Page generation is working good, but Some times there is a situation when contents in .html or .mht files goes out of A4(standard size for printing) size.So when I take a print of this page whole contents don't come.Some contents are cut down.But I want to print out the page with whole contents.What can I do?
|
|
|
|
|
There's nothing much you can do except resize the page dynamically to fit into an A4 or have a "Printer Friendly" page link separately.
SG
|
|
|
|
|
Hi Guys,
We are using Asp.Net,C# for coding our application. Also we've used CSLA.Net.
I haven't faced any problems with .Net 2.0 installation.
when I try to run the application. Once I provide UID and Password.
The following version related Exception occurs from code
(FormsAuthentication.GetRedirectUrl(username, false).ToUpper().Contains("DEFAULT.ASPX") (or)
FormsAuthentication.RedirectFromLoginPage(username, false);
EXCEPTION:
Type is not resolved for member 'CSLA.Security.BusinessPrincipal,CSLA, Version=2.200.4.0, Culture=neutral, PublicKeyToken=null'.
If any of you knows the solution for this problem. Please post your answers.
Regards,
Jagadeesh
|
|
|
|
|
Dear All,
I m facing problem ie.
I have filed a listbox with the help of javascript on the page. and need to access data through code behind to create a datatable for all elements filled by javascript. BUT the problem is code not getting the filled data(when i used view source no data was there in listbox).
should i create an index for listbox at the time i m entering data or problem lies some where else. plz suggest me better.
With Thanks & Regards
Amit Sk Sharma
|
|
|
|
|
Hi,
As I know that any thing you change through the Javascript, is not saved in the view state. Hence you can get it in the postback.
Yoy can get only selected value through request.form(name of the list control).
If you require all the inserted item you need to do it logically.
|
|
|
|
|
Hi,
when the admin login, iam displaying the list of users for the admin to view. when the admin select the details of a user there iam displaying the user details and also a button (say, Log into Resource Center as this user) in a seperate page. Here i have to pass the username and password of the user to a new url in a new window.How can we do this.
My code
StringBuilder strntrc = new StringBuilder();
strntrc.Append(""+Environment.NewLine);
strntrc.Append("" + Environment.NewLine);
strntrc.Append("" + Environment.NewLine);
strntrc.Append("" + Environment.NewLine);
strntrc.Append("");
This code is giving me error while execution:
Invalid postback or callback argument. Event validation is enabled using <pages enableeventvalidation="true"> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
I googled about this error but couldn't find the relevant source.
Please suggest me how can i resolve this.
Thanks
vijay
|
|
|
|
|
Hi
I created image buttons dynamicaly and i have added click event for image controls. but click event is not working
code is as follows
ImageButton img ;
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
for (int i = 1; i < 11; i++)
{
img = new ImageButton();
img.ID = "img" +i.ToString();
img.ImageUrl="pg/1212/"+ i +".jpg";
pl.Controls.Add(img); (pl is place holder control id)
}
}
img.Click += new ImageClickEventHandler( img_Click );
( while debugging showing the error in the above line as "object reference not set to instance of an object)
}
protected void img_Click ( object sender, ImageClickEventArgs e )
{
ImageButton img = ( ImageButton )sender;
Response.Write(img.ID + "");
}
plz let me know whats that error how to rectify that
thanks in advance
Haritha
|
|
|
|
|
Haritha,
remove the code from if(!IsPostBack)(means add the code in directly in page_load event) & Test it.
now event will works fine without any error.
regards
GV Ramana
|
|
|
|
|
hi... am working under asp.net with c#...
i need books books for asp.net with c#...
i want to learn more in asp.net.. is there any book available for asp.net with c#( not the ordinary beginner book).. if any free download site is there to get the books..
or if any one has the book plz.. send it to my id
balakrishnan_rk@sify.com
plz help me...
Balakrishnan
|
|
|
|
|
wrox publications Proffessional ASP.NET 2.0
regards
GV Ramana
|
|
|
|
|
From my point of view MSDN is the best. Try to get MSDN library.
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hi All,
I need to fetch all the Undelivered mail form my outlook inbox I am using ASP.NET 2.0(VB).
Can anyone suggest me with the code??
Thanks in advance...
|
|
|
|