|
|
Hi,
How i can call javascript OK function in click event of btnOK :
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GridviewGhataKhadamat.aspx.cs"
Inherits="Tina.WebUI.WorkFlows.Forms.Khadamat.GridviewGhataKhadamat" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function Close() {
window.close();
}
function OK(Id,Name,Code) {
var vReturnValue = new Object();
vReturnValue.Id = Id;
vReturnValue.Name = Name;
vReturnValue.Code = Code;
window.returnValue = vReturnValue;
window.close();
}
</script>
</head>
<body >
<form id="form1" runat="server">
<div>
<%----%>
<asp:GridView ID="gvGhataKhadamat" runat="server" AutoGenerateColumns="False" BackColor="White"
BorderColor="#CC9966" BorderStyle="Inset" BorderWidth="1px" CellPadding="4" Font-Names="Verdana">
<FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
<Columns>
<asp:TemplateField HeaderText="">
<ItemTemplate>
<input name="rbGhataKhadamat" type="radio" value="<%# Eval("Id") %>,<%# Eval("Name") %>,<%# Eval("Code") %>" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Id" HeaderText="ID" Visible="false" />
<asp:BoundField DataField="Code" HeaderText="<%$ Resources:Khadamat, Code %>" />
<asp:BoundField DataField="Name" HeaderText="<%$ Resources:Khadamat, Name %>" />
</Columns>
<RowStyle BackColor="White" ForeColor="#330099" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
<PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
</asp:GridView>
</div>
<asp:Button runat="server" ID="btnOk" Text="<%$ Resources:Khadamat, ok %>"
OnClick="btnOk_Click"/>
<asp:Button runat="server" ID="btnCancel" Text="<%$ Resources:Khadamat, cancel %>"
OnClientClick="Close()" />
</form>
</body>
</html>
and this is bihind code
protected void btnOk_Click(object sender, EventArgs e)
{
string[] strSelected=Request.Form["rbGhataKhadamat"].Split(new char[]{','});
Page.ClientScript.RegisterStartupScript(GetType(), "OK", "OK(" + "'" + strSelected[0] + "','" + strSelected[1] + "','" + strSelected[2] + "'"+");", true);
}
it doesnt call OK function.
id didnt used onclientclick event cause i must pass the selected grid values.
thanks in advanced!
modified 17-Nov-12 4:50am.
|
|
|
|
|
 I solved by adding <base target="_self" /> to of this (child) page.
my code is now this :
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GridviewGhataKhadamat.aspx.cs"
Inherits="Tina.WebUI.WorkFlows.Forms.Khadamat.GridviewGhataKhadamat"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function Close() {
window.close();
}
function OK(Id,Name,Code) {
var vReturnValue = new Object();
vReturnValue.Id = Id;
vReturnValue.Name = Name;
vReturnValue.Code = Code;
window.returnValue = vReturnValue;
window.close();
}
</script>
<base target=_self>
</head>
<body >
<form id="form1" runat="server">
<div>
<%----%>
<asp:GridView ID="gvGhataKhadamat" runat="server" AutoGenerateColumns="False" BackColor="White"
BorderColor="#CC9966" BorderStyle="Inset" BorderWidth="1px" CellPadding="4" Font-Names="Verdana">
<FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
<Columns>
<asp:TemplateField HeaderText="">
<ItemTemplate>
<input name="rbGhataKhadamat" type="radio" value="<%# Eval("Id") %>,<%# Eval("Name") %>,<%# Eval("Code") %>" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Id" HeaderText="ID" Visible="false" />
<asp:BoundField DataField="Code" HeaderText="<%$ Resources:Khadamat, Code %>" />
<asp:BoundField DataField="Name" HeaderText="<%$ Resources:Khadamat, Name %>" />
</Columns>
<RowStyle BackColor="White" ForeColor="#330099" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
<PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
</asp:GridView>
</div>
<asp:Button runat="server" ID="btnOk" Text="<%$ Resources:Khadamat, ok %>" UseSubmitBehavior="false" OnClick="btnOk_Click"/>
<asp:Button runat="server" ID="btnCancel" Text="<%$ Resources:Khadamat, cancel %>"
OnClientClick="Close()" />
</form>
</body>
</html>
and bihind code is :
protected void Page_Load(object sender, EventArgs e)
{
DataTable dtGhataKhadamat = new DataTable();
string strGridViewType = Request.QueryString["gridname"];
if (strGridViewType == "Ghata")
{
dtGhataKhadamat = tblKhadamatBL.KalaViewSelectByCommandKhadamat("GroupKalaID=15");
gvGhataKhadamat.DataSource = dtGhataKhadamat;
gvGhataKhadamat.DataBind();
}
else if (strGridViewType == "Khadamat")
{
dtGhataKhadamat = tblKhadamatBL.KhadamatTypeSelectAllKhadamat();
gvGhataKhadamat.DataSource = dtGhataKhadamat;
gvGhataKhadamat.DataBind();
}
}
protected void btnOk_Click(object sender, EventArgs e)
{
string[] strSelected = Request.Form["rbGhataKhadamat"].Split(new char[] { ',' });
string jsCommand = "OK(" + "'" + strSelected[0] + "','" + strSelected[1] + "','" + strSelected[2] + "'" + ")";
Page.ClientScript.RegisterStartupScript(GetType(), "OK", jsCommand, true);
}
|
|
|
|
|
<input type="submit" name="ctl00$ContentPlaceHolder$btnCancelNotification" value="Yes" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder$btnCancelNotification", "", true, "", "", false, false))" id="ctl00_ContentPlaceHolder_btnCancelNotification" class="cBtnRight" progressmessage="Saving…" style="width:70px;" >
|
|
|
|
|
It submits the form back to the server.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi.
I´ve been creating web pages for some years now, and been moving away from creating asp.net page-controls from codebehind because of the overhead they generate and the postback challenges you encounter. Instead I´ven been relying on javascript, jquery, old-school html elements and webservices, since they give me more elegant and light solutions.
The challenge I face now, is that it should be possible to construct a page based on a xml-setup file. The page design is luckily quite simple. It´s basically a vertical page with controls on top of each other.
I´m planning to create xml elements/types that define each control with it´s attributes. For an example a textbox with a css class, numeric text only value, which method to fire on textchanged, etc.. Or a button with a width, height, text, which (javascript?) method to fire upon click. Based on these types, I create the controls on the page.
My question is, should I create and insert these controls from codebehind, that means asp.net controls?
Or should I, for an example, build the dom in codebehind and let the javascript get the DOM from webservice, and then inject it on the page? Or what would be a good approach to this problem?
Thank you in advance
Kind regards,
Lars
|
|
|
|
|
I currently build main structures or containers in code behind via server controls on the server side because it's fast, and then use javascript to build the HTML inside the empty containers after a web service request to populate them on demand or if it's just simply needed.
On the Javascript side, I use createElement, I don't write "<>< >" out, I did that in my earlier days. Writing HTML in pure javascript is very time consuming, so I keep it limited now.
I don't know about your xml idea, still thinking about that, actually I don't get it.
But on the latter question, It's a balance between time to create, and functionality. I personally don't like the Microsoft Ajax toolkit, and I'm stopped using it completely now, replacing it with jquery.
|
|
|
|
|
Thanks alot for your answer.
Ok, so you build the page structure from codebehind, and the content controls with javascript/jquery.
My challenge is a little different though. What I meant with the xml thing, is that the whole site has a setup file, which defines the controls on the page. Like this:
<PageSetup>
<Control Type="TextBox" CssClass="test" PageOrder="1" Text="Default text in the textbox" />
<Control Type="Drowdown" CssClass="dropdownClass" PageOrder="2" >
<Item text="Dropdown item 1" Value="1000" />
<Item text="Dropdown item 2" Value="2000" />
</Control>
...
</PageSetup>
Hope that clearifies it a bit
I´ve started the project, and chosen to avoid the asp.net controls. So right now I build a long html string from codebehind, bases on the xml settings, and inject it on the page with jquery.
Any better idea?
Thanks alot for your time!
|
|
|
|
|
So what will be advantage of that solution against .aspx markup?
No more Mister Nice Guy... >: |
|
|
|
|
|
Hi,
I have a WCF serivce which is hosted in IIS. I want to have child config files for the wcf service so that I dont have to build different times to host in different environments like dev, staging and production.
I am not familiar with how to maintain child configuration files and access them in the web config file. If anybody can give me any idea or link with example, it would be helpfull for me.
I am also googling but anyone can give me any help its really thankful.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
I use a INI file I keep in the App_Data.
My server controls read the file and stage for the modes indicated in the file.
|
|
|
|
|
Hi,
I am using this code to bind news to the repeater using XMLDataSource. I want to ask, is it possible to have multiple XMLDataSources bineded to the same repeater so it will have xmlNews1, xmlNews2, xmlNews3, etc?
<asp:XmlDataSource ID="xmlNews" runat="server" XPath="/rss/channel/item/." DataFile="http://www.asp.net/community/articles/rss.ashx"></asp:XmlDataSource>
<asp:Repeater ID="repeaterNews" runat="server" DataSourceID="xmlNews">
<ItemTemplate>
<p>
<a href='<%#XPath("link")%>' target="_blank"><%#XPath("title")%></a>
</p>
</ItemTemplate>
</asp:Repeater>
|
|
|
|
|
You would require to merge all data source xmls into a single xml and then use it as XMLDataSource.
You may wish to use Linq To Xml to simplify your task.
|
|
|
|
|
<pre lang="HTML"> Hi All,
I have a control like this
<DC Type="ASPxTextBox" ErrorMessage="" Width="40px" CssClass="cText" IsSFControl="true"
MaskSettings-IncludeLiterals="DecimalSymbol" AutoCompleteType="None" BackgroundImage-Repeat="Repeat" ValidationSettings-Display="None"
ValidationSettings-ValidateOnLeave="False"
ID="POLICYEFFDATETIME" MaskSettings-Mask="<00..12>:<00..59>" ></DC>
This will take 12.59 as maximaum . But if i am entering morethan that like 22.99 , 12.59 is comming , i need to 00.00 if i am entering a higher value than 12.59. Please help
Thanks
Rk
|
|
|
|
|
Check Mask Setting? it reads 12 : 59 .. Could this be used for a time Box previously? - Where did the control come from? did you write it? .. Check Docs.
|
|
|
|
|
hi,my webapplication has ben changed outputpath,but show error msg:"Could not load file or assembly" in runtime,why?
<add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net"/> //Could not load file or assembly
<add name="WebSite.HttpModule" type="Framework.Common.HttpModule, Framework.Common" /> //Could not load file or assembly
</httpModules>
|
|
|
|
|
That means it can't find the dlls.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I have a loop in my razor view as
below
@foreach(var inmate in Model)
{
@inmate.inmateid
@inmate.inmateid
}
My Model is an IEnumerable of inmates
containing 2 inmate objects. But the
result I am getting in my browser is
6
6
7
7
Instead of
6
7
Please can someone tell me why this is
the case?
Thanks
|
|
|
|
|
Because you enumerating collection, and for each item You are writing this item twice. If you want it just once remove one @inmate.inmateid from inside foreach loop.
No more Mister Nice Guy... >: |
|
|
|
|
|
That really is a very silly mistake
|
|
|
|
|
Yes it is. But is not mine. You should answer to the question not mine answer.
Take care.
No more Mister Nice Guy... >: |
|
|
|
|
|
why don't you try to do this??:
@foreach(var inmate in Model)
{
@inmate.inmateid
}
|
|
|
|
|
Anyone have idea about Payroll Management System and Human Resource Management System in .net?
Please guide me how can I Start these projects.
|
|
|
|
|
First you need to know about each of the systems[^]. Explore, see the existing features you need, understand the product.
Once you are sure, start off features wise. Try out and post specific issues if you face.
|
|
|
|
|
That's specialty software, and you really have to know the industry or process before you start evaluating packages or start writing code.
And your heart has to be in it to take on payroll processing, because it's a boring subject. Plus the rules keep changing, so your app has to be adaptive.
Plus if you make a mistake, in the US, there's a huge penalty to pay.
|
|
|
|
|