|
Hi apurva kaushal
Thank you for the reply. On one of the other websites I am still waiting for responses to some of my questions. I shall play a bit with e.commandargument and see what I can come up with.
Kobus
|
|
|
|
|
In the HTML code of the page you can determine the index in the CommandArgument attribute:
<itemtemplate>
<asp:linkbutton commandname="select" commandargument="<%#Container.ItemIndex%>" text="<%# DataBinder.Eval(Container, "DataItem.CategoryName")%>" runat="server">
in the code-behind page:
private void DataList_Categories_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e)
{
if (e.CommandName == "select")
{ int index =Convert.ToInt32(e.CommandArgument);
}
}
Then you can send the index value to the other DataList(reload the same page or go to another page that contains the DataList) through a query string :
Response.Redirect("page.aspx?index="+selectedindex);
Then you can get the query string in the page that you were redirected to:
int categoryIndex=Convert.ToInt32(Request.QueryString["index"]);
But i think you should send a CategoryID field value instead of the index that points to the DataGrid item which could be changed.
I am too late but i will never give up
|
|
|
|
|
Hi TheEagle
Thanks for the quick reply, On another website I wait forever and no-one responds to questions. Your HTML code did not come up in the reply. Could you let me have that again please?
Kobus
|
|
|
|
|
Sorry my friend...i forgot to check my reply and i didnt check my email because i was busy...
<ItemTemplate>
<asp:LinkButton CommandName="select" CommandArgument='<%#Container.ItemIndex%>' Text='<%#DataBinder.Eval (Container, "DataItem.CategoryName")%>' runat="server"></asp:LinkButton>
</ItemTemplate>
"I am too late but i will never give up"
|
|
|
|
|
Hi,
I’ve got a problem with my onclick handlers for command buttons
being dropped on page render for a popup window.
On the opening window, I have several command buttons,
and they all have the standard click handler references
(as they should):
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
input type="submit" name="button03" value="submit text"
onclick="WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions( ...
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
... and this isn’t present for command buttons on the popup page.
On the popup window, the standard click handler is not in the button tags
on the rendered page - and the only buttons that have onclick set
are the ones where I use the Attributes property to set the
button for my own JavaScript handlers:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
string fn_call="javascript:doPostBack_JS('Test','','zxc1');"
new_button.Attributes.Add ("onclick", fn_call);
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
... and THAT renders OK:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
input type="submit" name="Button04" value="JavaScript Submit"
onclick="javascript:doPostBack_JS('Test','','zxc1');"
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
I set up a simple test case on the popup window page:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
[script language="C#" runat=server>
void SubmitBtn_Click(Object sender, EventArgs e)
{
Message.Text="Hello World!!";
}
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
[h3>Button Example[/h3>
Click on the submit button.
[asp:Button id="Button1"
Text="Submit"
OnClick="SubmitBtn_Click"
runat="server"/>
[asp:label id="Message" runat="server"/>
[/form>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
... and this is what got sent to the client:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
[h3>Button Example [/h3>
Click on the submit button.
[input type="submit" name="Button1" value="Submit" id="Button1" />
[span id="Message"> [/span>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
As should be obvious, onclick isn’t set on the rendered page.
The script source tags are present on BOTH the primary page,
AND the popup page:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
[script src="/Webfolder01/WebResource.axd?d=
[script src="/Webfolder01/WebResource.axd?d=
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This is the JavaScript function that opens the popup window:
// =======================================================
function popup01 ()
{
var win_url
= "http://localhost/Webfolder01/CtrlInit12b.aspx";
var win_name
= "_blank";
var win_chrome
= "toolbar=0,scrollbars=1,location=1,statusbar=0,menubar=0,resizable=1";
var win_dimn
= ",width=444,height=444,left = 290,top = 162";
DBname_popup = window.open (win_url, win_name, win_chrome + win_dimn);
if (window.focus) {DBname_popup.focus()}
stop_postback = true;
}
// =======================================================
The really freaky thing about this is that it was working last week,
after I tested it - and it WAS working OK.
Does anyone have any idea as to why this is happening?
THANK YOU FOR YOUR ATTENTION TO THIS!!!
.
wylbur
-=-=-=-=-=-=-=-
|
|
|
|
|
Hi,
So I have this problem, here it is.
I have a repeater with a check box in each itemtemplate. What I need is, to find all checked checkboxes (in the repeater) and send their respective "ID" properties back to the Invite(string ID) method on the server (my aspx.cs file).
Does anybody know how to do this ? I was trying to do it with javascript but I'm not good enough. I guess if somebody could just show me how, using javascript, to find all the seleted checkboxes in my repeater and getting their ID properties, (i.e. <%# DataBinder.Eval(Container.DataItem, "ID") %> ), then I think i know how to post it back to the server us javascript.
Thanks.
/\ |_ E X E GG
-- modified at 0:43 Monday 15th May, 2006
|
|
|
|
|
Alex,
The way to access the checkbox with javascript in the repeater is similar to that in the datagrid control, you can see the site[^] for the sample script.
However, IMO you may not need to use javascript to access the checkbox in the RepeaterItem to get the id values, instead you can walk through the Repeater.Items[^] collection, and get reference to the checkbox control, you then can check if the checkbox is selected or not, and get the id value bound to it. And I think you may want to collect the ids of the checked checkboxes with javascript when you intend to use AJAX to do something.
|
|
|
|
|
HAHA,
I just discovered the Items property. This looks good !
/\ |_ E X E GG
|
|
|
|
|
so If I binded a class AdminPaper to the Repeater, I should be able to cast Items[i] in to an AdminPaper right?
/\ |_ E X E GG
|
|
|
|
|
|
Hi All,
I have no idea how to save files on client machine in ASP.NET. I tried with Request.Response(), but i failed to do that. Can anyone provide me the solution.
I am trying to save a .xml file in C:\TEMP of the client machine
Regards
Suma B R
|
|
|
|
|
using System.Net;
WebClient client=new WebClient();
client.DownloadFile("url path of the file on the server","Localfilename");
Please..may you tell me why do you want to download .xml file on the client machine?
"I am too late but i will never give up"
|
|
|
|
|
Hi
Thanks a lot for solution. I am tried out for the same.
client.DownloadFile("http://132.186.90.79/RRM/SavedXML.xml","SavedXML.xml");
This works very fine if i run on the server itself, but when ran on client machine its not saving the file.
I seached the file in entire client machine, but could not find it.
I am generating XML file with fields entered by user and trying to provide a saved copy for the user.
Regards
Suma
Regards
Suma B R
|
|
|
|
|
Well..I think you should put your question as a new question (new thread) in this forum..There are some professional programmers who are better than me .I hope they answer your question.
"I am too late but i will never give up"
|
|
|
|
|
My situation,I have two pages ,A.aspx and B.aspx. On A.aspx i have a datagrid to show informaton, each row of the datagrid consists of its own select button. when the button clicked, B.aspx will pop up. When the second time the user click another row's button on A.aspx( B.aspx window not close yet), the B.aspx will auto refresh at that time and show another information. For the 3rd time ,the B.aspx also auto refresh when the user click the another button on A.aspx and so on.
So , may i know how to code to allow the B.aspx will auto refresh when the user click the button on A.aspx?
Thanks a lot.
-- modified at 23:45 Sunday 14th May, 2006
|
|
|
|
|
I don't know if anyone will be able to help me, but I have a real strange error with c++ on Visual Studio on my XP. I have a code fragment:
if( !Directory::Exists(out1))
Directory::CreateDirectory(out1);
Exists compiles with no problem but CreateDirectory gives me the following error:
error C2039 'CreateDirectoryA' is not a member of 'System::IO:Directory'
When I put the cursor on CreateDirectory, it correctly identifies it as System::IO:CreateDirectory(System::String __gc*). Then when I compile Exists goes through OK, but CreateDirectory turns into the ANSI version of CreateDirectory which it then claims isn't part of the class (as it probably isn't). Who asked the compiler to turn CreateDirectory into CreateDirectoryA?
If anyone has any suggestions, I'd be very grateful.
Thanks,
Ilan
|
|
|
|
|
I found the problem in WinBase.h. It has
#ifdef UNICODE
#define CreateDirectory CreateDirectoryW
#else
#define CreateDirectory CreateDirectoryA
#endif // !UNICODE
I added #undef CreateDirectory and it now compiles.
|
|
|
|
|
Hi
I have an asp.net app .I hold the userID in cookie caz next time that user want to connect to site username is shown to him as welcome text.
But sometimes user connect to site and see another username and doesnt see his username as welcome.
what should i do?
|
|
|
|
|
Could you show some code ?
------------------------------ "The Soapbox has been so ..."
|
|
|
|
|
|
Client script is the right way, Code behind way will cause the page to postback.
------------------------------ "The Soapbox has been so ..."
|
|
|
|
|
What do u mean by "Client script" ?
|
|
|
|
|
Client script means that page will not get post back to the server and on the client machine itself it will do the process.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hello, Friends
I'm binding some data in my GridView using ObjectDataSouce. I need too, specify some SelectParameters what are stored in ViewState, but in the "Parameter Collection Editor Dialog", the "Parameter Source" option shows only: Cookie, Control, Form, Profile, QueryString, Session
I wish bind to some value in ViewState. How not appears the option "ViewState", I need place my values in some HiddenField control to bind...
Someone knows how I do to bind to ViewState?
Regards
Fabio
|
|
|
|
|
Hi there,
There's no such a ViewState parameter existing, but there are two work-around options come to mind that you may consider:
+ Use the general Parameter for the select parameter, and create an event handler for the Selecting event. In the handler, you can populate the select parameter value from the ViewState, then add it to the InputParameters collection.
+ Develop your own custom parameter, say ViewStateParameter, which inherits from the base class Parameter . In the custom class, you at least override the protected method Evaluate to populate the ViewState and return the value. You also should remember that the ViewState is a protected property of the Control class, so if you want to access the ViewState of the control, for example the ViewState of the Page instance, from the outside of the control, you may consider using the reflection.
|
|
|
|