小编use*_*032的帖子

在 C# 中样式化 KML 文件

我已经在 asp.net(C#) 中编写了 webapp,它从数据库中获取坐标并创建 .KML,然后我将其放入谷歌地图并工作正常,即绘制线串,但我想将样式放入其中,即更改地标样式、颜色,尺寸等。网上没有关于它的帮助。

代码:

using SharpKml.Base;
using SharpKml.Dom;
using SharpKml.Engine;


    protected void Button1_Click(object sender, EventArgs e)
    {
        var document = new Document();
        document.Id = "null";
        document.Name = "null";
        LineString linestring = new LineString();
         CoordinateCollection coordinates = new CoordinateCollection();

        SqlConnection sqlcon = new SqlConnection(conStr);
       // String com = "select Latitude, Longitude from Coordinates where IMEI=@txtIMEI";
        SqlCommand sqlcom = new SqlCommand("GetLatLon", sqlcon);
        sqlcom.CommandType = CommandType.StoredProcedure;
        sqlcom.Parameters.Add("@IMEI", SqlDbType.VarChar).Value= TextBox1.Text;

        DataTable dt = new DataTable();
        SqlDataAdapter sda = new SqlDataAdapter(sqlcom);
        sda.Fill(dt);

        try …
Run Code Online (Sandbox Code Playgroud)

c# asp.net google-maps c#-4.0 sharpkml

6
推荐指数
1
解决办法
4944
查看次数

是否足够使用asp.net验证器?

我正在使用asp.net验证,如必填字段验证器等.我想知道是否足够把这些验证器或后端的东西也应该完成?我的意思是它工作得很好,但我曾经听说验证也应该在后端等完成,因为客户端验证可以关闭,这将导致应用程序崩溃?这是真的吗?

例如

<asp:TextBox ID="txtFrom" runat="server"></asp:TextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                ControlToValidate="txtFrom" Display="None" ErrorMessage="" 
                                ForeColor="Red" >
     </asp:RequiredFieldValidator>
    &nbsp; To :
    <asp:CalendarExtender ID="Calender" Format="dd/MMM/yyyy" runat="server" TargetControlID ="txtFrom"></asp:CalendarExtender>
    <asp:TextBox ID="txtTo" runat="server"></asp:TextBox>
      <asp:CalendarExtender ID="CalendarExtender1" Format="dd/MMM/yyyy" runat="server" TargetControlID ="txtTo"></asp:CalendarExtender>
    <asp:RequiredFieldValidator ID="RequiredFieldValisdator9" runat="server" 
                                ControlToValidate="txtTo" Display="None" ErrorMessage="" 
                                ForeColor="Red" >
     </asp:RequiredFieldValidator>
Run Code Online (Sandbox Code Playgroud)

伙计们,感谢您的回复,我试图验证提交按钮上的页面,像这样,是否正确?

protected void btnGenReport_Click(object sender,EventArgs e){//此事件生成特定日期之间投诉的报告.

    try
    {
       //my report binding code

    }
    catch (Exception ex)
    {
        Response.Write(ex.Message.ToString());
    }

    Page.Validate();
    if (Page.IsValid)
    {
        txtFrom.Text = "Validated";
    }
    else 
    {
        txtFrom.Text = "NOT VALIDATED";
    }

}
Run Code Online (Sandbox Code Playgroud)

c# asp.net validation requiredfieldvalidator

1
推荐指数
1
解决办法
538
查看次数

c#中的Accessor Mutators返回错误的值

我在asp.net(C#)中使用accessor/mutators来分配和获取值.

我有两个事件:

protected void ddlDepartments_SelectedIndexChanged(object sender, EventArgs e)
{
    accessVariables.DepID = Convert.ToInt32(ddlDepartments.SelectedValue);
}
protected void chkIsHead_CheckedChanged(object sender, EventArgs e)
{
    Response.Write(accessVariables.DepID);
}
Run Code Online (Sandbox Code Playgroud)

它称之为:

public class AccessibleVariables
{
    public int depID { get; set; }
    public int DepID 
    {
        get { return depID; }
        set { depID = value; }
    }
 }
Run Code Online (Sandbox Code Playgroud)

第二个事件返回0,为什么?我运行调试器,我检查,(设置)分配实际值,这是完美但得到不返回实际值,它总是返回0,为什么?

.net c# asp.net

0
推荐指数
1
解决办法
179
查看次数