|
What was it in my post that did make you think that you should use Response.Redirect?
---
b { font-weight: normal; }
|
|
|
|
|
how to write the code for sending image with message
|
|
|
|
|
|
|
|
i have a datagrid that i want create the column of datagrid myself. i write this code but its not right in visual studio 2005 how can i do this work?
BoundColumn dgColStord = new BoundColumn();
dgColStord.HeaderText = dsHeader.Tables[0].Rows[i]["stord_desc"].ToString();
dgColStord.DataField = i.ToString();
dgColStord.Columns.Add(dgColStord);
the last line is not right it give error for columns.
|
|
|
|
|
check that what is the value of i? coz i's value shd be the name of column in the datasource whose value will be set in the bound column
why dont u try using a template column and sets the value in that columns coz bound column always requires a column name in the DataField here in ur code i seems to be an index
|
|
|
|
|
Hi,
I am using a Master page for a child page that requires do Client-side data validation using Javascript. The function in Javascript need to take the form as argument, so it can access all the controls within the form. The javascript is registered in the child page. When I tried to pass the form argument into javascript funciton, it alway fails. If I do it without using master page, it works fine. Is there anything particular I need to take care when using a master page for a child page which contains client-side validation?
Here is how the code I used:
<asp:button id="btnSubmit" runat="server" text="onClick" onclientclick="return DataValidation(Form1)">
Can anybody give me some hint about what I do wrong? Thanks in advance!
|
|
|
|
|
why dont u use something like this:
...="return DataValidation('Form1')"
|
|
|
|
|
I did try to pass 'Form1'.. but it doesn't work either.
|
|
|
|
|
Hi Vicky!
That approach dowsn't work because during page rendering (i.e. result page from server to client) the names of controls change IF you have created a nested environment. For example, if you have a master page that has ContentPlaceHolder1, and one nested child page displayed through that ContentPlaceHolder1 with a text box control and a button (with their default names) this would be rendered with these id's:
ctl00_ContentPlaceHolder1_TextBox1 (instead of TextBox1)
ctl00_ContentPlaceHolder1_Button1 (instead of Button1)
If you have a nested master page, then the controls would have these id's:
ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_TextBox1 (instead of TextBox1)
ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_Button1 (instead of Button1)
You can pass those control id's to your javascript, it should work. However, there are other ways of 'programmatically' retrieving the server control's id, but that requires interfacing with ICallbackEventHandler and yada yada yada... I find it best to keep things simple
BTW Vicky, I couldn't see your code! Can you paste it once more so maybe I could be more specific in my answer?
Nila
"...for that, I will need a large cup of coffee and a brand muffin!" -Samantha Bea
|
|
|
|
|
Hi Nila,
Here is the code I used when calling the JavaScript function:
<asp:button id="btnSubmit" runat="server" text="onClick" onclientclick="return DataValidation(Form1)">
Would you mind to refer me more information about ICallbackEventHandler? Anyway, I will try the approach of passing control id.
Thank you very much for your help!
|
|
|
|
|
<asp:button id="btnSubmit" runat="server" text="onClick" onclientclick="return DataValidation(Form1)">
|
|
|
|
|
It seems that the forum doesn't take some special characters. Let me try again :
This is the button control :
.... ID="btnSubmit" runat="server" Text="onClick" onclientclick="return DataValidation(Form1)" ....
|
|
|
|
|
Vicky, the "onClick" should be the name of the client side method you pass onto the javascript, and not the text property of your button. Anyways, this is the correct button name for you: ctl00_ContentPlaceHolder1_btnSubmit
Let me know if you are still having problems.
Nila
"...for that, I will need a large cup of coffee and a brand muffin!" -Samantha Bea
|
|
|
|
|
Nila,
I have tried the simpliest Javascript function. Still no luck... Here is what I did:
---Master page : include ..script type="text/javascript" src="Test.js" .. in the head tag.
---Child page: within Content tag, only have one button named Button1, then onclientclick event call "return TestForm(aspnetForm);", where aspnetForm is the form name I got from rendered HTML page by viewing source.
---Test.js file: Only one function which should take aspnetForm as parameter and do a simple alert Button1's value:
function TestForm(form) {
with (form) {
alert (_ctl0:ContentPlaceHolder1:Button1.value);
return false;
}
}
where _ctl0:ContentPlaceHolder1:Button1 is the Button1's name I got form rendered HTML page by viewing source.
Basically, what I try to do is to include a .js file in master page, then pass form into a javascript function,finally access the controls in the form to check some controls's value and do data validation.
I really have no idea what is wrong with this simple test... Could you tell what I am missing? I really appreciate your help!
Thanks a lot!
|
|
|
|
|
Vicky, this sounds bizzare... although I had issues too when I would point to a javascript file instead of embedding it within the HTML. If you only want an alert box, then do this:
In your child page, add the following line within the Page_Load event:
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
...<br />
<br />
if (!Page.IsPostBack)
{<br />
this.Button1.Attributes.Add("onclick", "alert('any message can go here...');");<br />
}<br />
}
This would be a simple way to do alert. Try and see if it works, if not, send your source code to me NightHawk13@hotmail.com (if you feel comfortable doing so) and I will try to correct your code.
Nila
"...for that, I will need a large cup of coffee and a brand muffin!" -Samantha Bea
|
|
|
|
|
Hi Vicky,
Your best bet as far as learning how to implement and work with ICallbackEventHandler interface is to look up msdn2: http://msdn2.microsoft.com/en-us/library/system.web.ui.icallbackeventhandler(VS.80).aspx
There are many other developer sites, including codeproject, where you can get real-life examples of ICallbackEventHandler implementation. However, when you are doing your research, make sure to look up only those that have implemented TWO methods associated with this interface void RaiseCallbackEvent(String eventArgument) and String GetCallbackResult() Some examples are from 2.0 beta and have only one method.
Here is a good code example: http://msdn2.microsoft.com/en-us/library/ms366515(vs.80).aspx
Nila
"...for that, I will need a large cup of coffee and a brand muffin!" -Samantha Bea
|
|
|
|
|
see if you accessing a textbox with id like txtName
then better user of
document.getelementById('<% txtName.clientId %>').value
it will work with your master pages.
|
|
|
|
|
You can also check the Id of your controls in run-time clicking on viewsource.
Eric H.
|
|
|
|
|
Hello,
Everytime I try to use the ReportView on a web app. I get the same error over and over. "A data source instance has not been supplied for the data source 'dsReport_Contact'."
Weather I setup the data source for the report using code or the designer I keep getting this error. I've tried to use the smart tag for the report viewer control. I click the 'Choose Data Source' link and get the dialog. I then browse the 'Data Source Instance' drop down. But once I select the table 'Contact' from my DataSet. Visual Studio bombs out.
Any help would be great. Thank you.
|
|
|
|
|
hi to all
What is the difference between IsPostBack and Not IsPostBack
thanx
regards
saravanan
|
|
|
|
|
Page.IsPostBack property
Gets a value indicating whether the page is being loaded in response to a client postback, or if it is being loaded and accessed for the first time.
MSDN is your friend
only two letters away from being an asset
|
|
|
|
|
Every time that user load or reload a page, he's making a postback (roundtrip to server, client->server->client), Except the FIRST TIME that user load the page (server->client) this condition is call isnotpostback.
You can reach this condition writing this code lines on load Form event.
<br />
if(!ispostback)
{<br />
}<br />
keep Learning and you never will be out of date...
|
|
|
|
|
The Page.IsPostback property is a property you can use to test whether your page is being loaded for the first time or whether it is being loaded as a result of a Postback, meaning that user has done something on the page and caused a reload event to happen.
Hope this helps
|
|
|
|